Commit 2dd191f0 authored by paulirish's avatar paulirish Committed by Commit bot

DevTools: Hex colors aren't forced to uppercase

BUG=577505

Review URL: https://codereview.chromium.org/1797323003

Cr-Commit-Position: refs/heads/master@{#381628}
parent 17d7a2e7
......@@ -7,8 +7,8 @@ Dumping 'red' in different formats:
- hsla(0, 100%, 50%, 1)
- hsv(0, 100%, 100%)
- hsva(0, 100%, 100%, 1)
- #FF0000
- #F00
- #ff0000
- #f00
- red
- default: red
- inverse color: rgba(0, 255, 255, 1)
......@@ -33,8 +33,8 @@ Dumping 'blue' in different formats:
- hsla(240, 100%, 50%, 1)
- hsv(240, 100%, 100%)
- hsva(240, 100%, 100%, 1)
- #0000FF
- #00F
- #0000ff
- #00f
- blue
- default: blue
- inverse color: rgba(255, 255, 0, 1)
......@@ -46,8 +46,8 @@ Dumping 'cyan' in different formats:
- hsla(180, 100%, 50%, 1)
- hsv(180, 100%, 100%)
- hsva(180, 100%, 100%, 1)
- #00FFFF
- #0FF
- #00ffff
- #0ff
- cyan
- default: cyan
- inverse color: rgba(255, 0, 0, 1)
......@@ -59,8 +59,8 @@ Dumping 'magenta' in different formats:
- hsla(300, 100%, 50%, 1)
- hsv(300, 100%, 100%)
- hsva(300, 100%, 100%, 1)
- #FF00FF
- #F0F
- #ff00ff
- #f0f
- magenta
- default: magenta
- inverse color: rgba(0, 255, 0, 1)
......@@ -72,8 +72,8 @@ Dumping 'yellow' in different formats:
- hsla(60, 100%, 50%, 1)
- hsv(60, 100%, 100%)
- hsva(60, 100%, 100%, 1)
- #FFFF00
- #FF0
- #ffff00
- #ff0
- yellow
- default: yellow
- inverse color: rgba(0, 0, 255, 1)
......@@ -85,8 +85,8 @@ Dumping 'white' in different formats:
- hsla(0, 0%, 100%, 1)
- hsv(0, 0%, 100%)
- hsva(0, 0%, 100%, 1)
- #FFFFFF
- #FFF
- #ffffff
- #fff
- white
- default: white
- inverse color: rgba(0, 0, 0, 1)
......@@ -111,7 +111,7 @@ Dumping 'rgb(94, 126, 91)' in different formats:
- hsla(115, 16%, 43%, 1)
- hsv(115, 28%, 49%)
- hsva(115, 28%, 49%, 1)
- #5E7E5B
- #5e7e5b
- null
- null
- default: rgb(94, 126, 91)
......@@ -137,7 +137,7 @@ Dumping 'hsl(212, 55%, 32%)' in different formats:
- hsla(212, 55%, 32%, 1)
- hsv(212, 71%, 50%)
- hsva(212, 71%, 50%, 1)
- #254F7E
- #254f7e
- null
- null
- default: hsl(212, 55%, 32%)
......@@ -164,9 +164,9 @@ Dumping '#00FFFF' in different formats:
- hsv(180, 100%, 100%)
- hsva(180, 100%, 100%, 1)
- #00FFFF
- #0FF
- #0ff
- cyan
- default: #00FFFF
- default: #00ffff
- inverse color: rgba(255, 0, 0, 1)
- setAlpha(0.42): rgba(0, 255, 255, 0.42)
Dumping '#0FF' in different formats:
......@@ -176,10 +176,10 @@ Dumping '#0FF' in different formats:
- hsla(180, 100%, 50%, 1)
- hsv(180, 100%, 100%)
- hsva(180, 100%, 100%, 1)
- #00FFFF
- #00ffff
- #0FF
- cyan
- default: #0FF
- default: #0ff
- inverse color: rgba(255, 0, 0, 1)
- setAlpha(0.42): rgba(0, 255, 255, 0.42)
......@@ -9,7 +9,7 @@ Running: editKeywordAsOriginal
1px solid red
Running: editKeywordAsHex
1px solid #F00
1px solid #f00
Running: editKeywordAsHSL
1px solid hsl(0, 100%, 50%)
......@@ -21,7 +21,7 @@ Running: editHexAsOriginal
#ffffee
Running: editHexAsHex
#FFE
#ffe
Running: editHexAsHSL
hsl(60, 100%, 97%)
......
......@@ -4,9 +4,9 @@ Tests WebInspector.Spectrum
Testing: red
red
Testing: #ABC
#ABC
#abc
Testing: #ABCDEF
#ABCDEF
#abcdef
Testing: rgb(1, 2, 3)
rgb(1, 2, 3)
Testing: rgba(1, 2, 3, 0.2)
......
......@@ -7,8 +7,8 @@ color: red
simple: true
original: red
nickname: red
hex: #FF0000
shorthex: #F00
hex: #ff0000
shorthex: #f00
rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%)
......@@ -16,7 +16,7 @@ color: #F00
simple: true
original: #F00
nickname: red
hex: #FF0000
hex: #ff0000
shorthex: #F00
rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%)
......@@ -25,8 +25,8 @@ color: rgb(255,0,0)
simple: true
original: rgb(255,0,0)
nickname: red
hex: #FF0000
shorthex: #F00
hex: #ff0000
shorthex: #f00
rgb: rgb(255,0,0)
hsl: hsl(0, 100%, 50%)
......@@ -34,8 +34,8 @@ color: rgb(300,0,0)
simple: true
original: rgb(300,0,0)
nickname: red
hex: #FF0000
shorthex: #F00
hex: #ff0000
shorthex: #f00
rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%)
......@@ -43,8 +43,8 @@ color: rgb(255,-10,0)
simple: true
original: rgb(255,-10,0)
nickname: red
hex: #FF0000
shorthex: #F00
hex: #ff0000
shorthex: #f00
rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%)
......@@ -52,8 +52,8 @@ color: rgb(110%, 0%, 0%)
simple: true
original: rgb(110%, 0%, 0%)
nickname: red
hex: #FF0000
shorthex: #F00
hex: #ff0000
shorthex: #f00
rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%)
......@@ -69,8 +69,8 @@ color: hsl(-120, 100%, 50%)
simple: true
original: hsl(-120, 100%, 50%)
nickname: blue
hex: #0000FF
shorthex: #00F
hex: #0000ff
shorthex: #00f
rgb: rgb(0, 0, 255)
hsl: hsl(-120, 100%, 50%)
......@@ -78,8 +78,8 @@ color: hsl(-120, 200%, 200%)
simple: true
original: hsl(-120, 200%, 200%)
nickname: white
hex: #FFFFFF
shorthex: #FFF
hex: #ffffff
shorthex: #fff
rgb: rgb(255, 255, 255)
hsl: hsl(-120, 200%, 200%)
......@@ -120,7 +120,7 @@ color: hsl(200.5,0%,50%)
color: hsla(200,1.5%,50%,1)
simple: true
original: hsla(200,1.5%,50%,1)
hex: #7E8081
hex: #7e8081
rgb: rgb(126, 128, 129)
hsl: hsl(200, 1%, 50%)
......@@ -160,8 +160,8 @@ color: rgba(255, 0, 0, 5)
simple: true
original: rgba(255, 0, 0, 5)
nickname: red
hex: #FF0000
shorthex: #F00
hex: #ff0000
shorthex: #f00
rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%)
......
......@@ -80,7 +80,7 @@ WebInspector.Color.parse = function(text)
var match = value.match(simple);
if (match) {
if (match[1]) { // hex
var hex = match[1].toUpperCase();
var hex = match[1].toLowerCase();
var format;
if (hex.length === 3) {
format = WebInspector.Color.Format.ShortHEX;
......@@ -327,11 +327,11 @@ WebInspector.Color.prototype = {
case WebInspector.Color.Format.HEX:
if (this.hasAlpha())
return null;
return String.sprintf("#%s%s%s", toHexValue(this._rgba[0]), toHexValue(this._rgba[1]), toHexValue(this._rgba[2])).toUpperCase();
return String.sprintf("#%s%s%s", toHexValue(this._rgba[0]), toHexValue(this._rgba[1]), toHexValue(this._rgba[2])).toLowerCase();;
case WebInspector.Color.Format.ShortHEX:
if (!this.canBeShortHex())
return null;
return String.sprintf("#%s%s%s", toShortHexValue(this._rgba[0]), toShortHexValue(this._rgba[1]), toShortHexValue(this._rgba[2])).toUpperCase();
return String.sprintf("#%s%s%s", toShortHexValue(this._rgba[0]), toShortHexValue(this._rgba[1]), toShortHexValue(this._rgba[2])).toLowerCase();;
case WebInspector.Color.Format.Nickname:
return this.nickname();
}
......
......@@ -32,7 +32,7 @@
"defaultValue": "original",
"options": [
{ "title": "Set color format as authored", "text": "As authored", "value": "original" },
{ "title": "Set color format to HEX", "text": "HEX: #DAC0DE", "value": "hex", "raw": true },
{ "title": "Set color format to HEX", "text": "HEX: #dac0de", "value": "hex", "raw": true },
{ "title": "Set color format to RGB", "text": "RGB: rgb(128, 255, 255)", "value": "rgb", "raw": true },
{ "title": "Set color format to HSL", "text": "HSL: hsl(300, 80%, 90%)", "value": "hsl", "raw": true }
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment