<commit_before>/*
 * Created on May 17, 2006
 */
package uk.org.ponder.rsf.renderer.html.decorators;

import java.util.Map;

import uk.org.ponder.htmlutil.HTMLUtil;
import uk.org.ponder.rsf.components.decorators.UIColourDecorator;
import uk.org.ponder.rsf.components.decorators.UIDecorator;
import uk.org.ponder.rsf.renderer.DecoratorRenderer;

public class HTMLColourDecoratorRenderer implements DecoratorRenderer {

  public void modifyAttributes(UIDecorator decoratoro, String tagname, Map tomodify) {
    UIColourDecorator decorator = (UIColourDecorator) decoratoro;
    if (decorator.foreground != null) {
      String fgstring = Integer.toHexString(decorator.foreground.getRGB() & 0xffffff);
      HTMLUtil.appendStyle("color", "#"+fgstring, tomodify);
    }
    if (decorator.background != null) {
      String bgstring = Integer.toHexString(decorator.background.getRGB() & 0xffffff);
      HTMLUtil.appendStyle("background-color", "#"+bgstring, tomodify);
    }
  }

  public Class getRenderedType() {
    return UIColourDecorator.class;
  }

  public String getContentTypes() {
    return "HTML, HTML-FRAGMENT";
  }

  
}<commit_msg>Colour padding problem<commit_after>/*
 * Created on May 17, 2006
 */
package uk.org.ponder.rsf.renderer.html.decorators;

import java.util.Map;

import uk.org.ponder.htmlutil.HTMLUtil;
import uk.org.ponder.rsf.components.decorators.UIColourDecorator;
import uk.org.ponder.rsf.components.decorators.UIDecorator;
import uk.org.ponder.rsf.renderer.DecoratorRenderer;

public class HTMLColourDecoratorRenderer implements DecoratorRenderer {

  public static final String zeros = "000000";

  public String padLeft(String topad) {
    return zeros.substring(6 - topad.length()) + topad;
  }

  public void modifyAttributes(UIDecorator decoratoro, String tagname,
      Map tomodify) {
    UIColourDecorator decorator = (UIColourDecorator) decoratoro;
    if (decorator.foreground != null) {
      String fgstring = padLeft(Integer.toHexString(decorator.foreground
          .getRGB() & 0xffffff));
      HTMLUtil.appendStyle("color", "#" + fgstring, tomodify);
    }
    if (decorator.background != null) {
      String bgstring = padLeft(Integer.toHexString(decorator.background
          .getRGB() & 0xffffff));
      HTMLUtil.appendStyle("background-color", "#" + bgstring, tomodify);
    }
  }

  public Class getRenderedType() {
    return UIColourDecorator.class;
  }

  public String getContentTypes() {
    return "HTML, HTML-FRAGMENT";
  }

}
{'fraction_non_alphanumeric': 0.11289674568099639, 'fraction_numerical': 0.009240658899156288, 'mean_word_length': 4.2092050209205025, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1378653', 'n_tokens_mistral': 838, 'n_tokens_neox': 812, 'n_words': 150}