lib/milight/bulb.rb
def color_code(val)
      if val.is_a? String
        code = val
        val = code.hex
        val = -1 if val == 0 && code != '00'
      elsif val.is_a? Fixnum
        code = val
        val = val.to_i
        code = '%02x' % val
      else
        return nil
      end

      if (0..255).cover? val
        code
      else
        nil
      end
    end
def color_code(val)
      if val.is_a? String
        code = val
        val = code.hex
        val = -1 if val == 0 && code != '00'
      elsif val.is_a? Fixnum
        code = val
        val = val.to_i
        code = '%02x' % val
      else
        return nil
      end

      if (0..255).cover? val
        code
      else
        nil
      end
    end
parse color code ("00" .. "ff")
 valid color-value is 0..255