     styleString = container.getAttribute('style') or ''
     return _.reduce(styleString.split(';').slice(0, -1), (styles, str) ->
       [name, value] = str.split(':')
+      name = name.slice(1) if name[0] == ' '
       value = value.slice(1) if value[0] == ' '
       styles[name] = value
       return styles

  matchContainer: (container) ->
    return false unless super(container)
    styles = Scribe.Format.Style.getStyleObject(container)
    if styles[@cssName]?
      for formatName of @styles
        return formatName if @matchFn(formatName, styles[@cssName])
    return false


class Scribe.Format.Bold extends Scribe.Format.Tag


class Scribe.Format.Color extends Scribe.Format.Style
  @COLORS: {
    'black'   : '#000000'
    'red'     : '#FF0000'
    'blue'    : '#0000FF'
    'lime'    : '#00FF00'
    'teal'    : '#00FFFF'
    'magenta' : '#FF00FF'
    'yellow'  : '#FFFF00'
    'white'   : '#FFFFFF'
  }

  @normalizeColor: (color) ->
    color = Scribe.Format.Color.COLORS[color] if Scribe.Format.Color.COLORS[color]?
    if color[0] == '#'
      if color.length == 4
        color = '#' + _.map(color.slice(1), (letter) ->
          letter + letter
        ).join('')
      return color
    else if color.indexOf('rgb(') == 0
      color = color.slice(4)
      color = _.reduce(color.split(',').slice(0, 3), (color, part) ->
        c = parseInt(part, 10).toString(16).toUpperCase()
        c = '0' + c if c.length == 1
        return color + c
      , '#')
      return color
    else
      return '#000000'

  @matchColor: (cssValue) ->
    color = Scribe.Format.Color.normalizeColor(cssValue)
    for key,value of @styles
      return key if value == color
    return false

  constructor: (@root) ->
    colors = _.clone(Scribe.Format.Color.COLORS)
