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: ...@@ -7,8 +7,8 @@ Dumping 'red' in different formats:
- hsla(0, 100%, 50%, 1) - hsla(0, 100%, 50%, 1)
- hsv(0, 100%, 100%) - hsv(0, 100%, 100%)
- hsva(0, 100%, 100%, 1) - hsva(0, 100%, 100%, 1)
- #FF0000 - #ff0000
- #F00 - #f00
- red - red
- default: red - default: red
- inverse color: rgba(0, 255, 255, 1) - inverse color: rgba(0, 255, 255, 1)
...@@ -33,8 +33,8 @@ Dumping 'blue' in different formats: ...@@ -33,8 +33,8 @@ Dumping 'blue' in different formats:
- hsla(240, 100%, 50%, 1) - hsla(240, 100%, 50%, 1)
- hsv(240, 100%, 100%) - hsv(240, 100%, 100%)
- hsva(240, 100%, 100%, 1) - hsva(240, 100%, 100%, 1)
- #0000FF - #0000ff
- #00F - #00f
- blue - blue
- default: blue - default: blue
- inverse color: rgba(255, 255, 0, 1) - inverse color: rgba(255, 255, 0, 1)
...@@ -46,8 +46,8 @@ Dumping 'cyan' in different formats: ...@@ -46,8 +46,8 @@ Dumping 'cyan' in different formats:
- hsla(180, 100%, 50%, 1) - hsla(180, 100%, 50%, 1)
- hsv(180, 100%, 100%) - hsv(180, 100%, 100%)
- hsva(180, 100%, 100%, 1) - hsva(180, 100%, 100%, 1)
- #00FFFF - #00ffff
- #0FF - #0ff
- cyan - cyan
- default: cyan - default: cyan
- inverse color: rgba(255, 0, 0, 1) - inverse color: rgba(255, 0, 0, 1)
...@@ -59,8 +59,8 @@ Dumping 'magenta' in different formats: ...@@ -59,8 +59,8 @@ Dumping 'magenta' in different formats:
- hsla(300, 100%, 50%, 1) - hsla(300, 100%, 50%, 1)
- hsv(300, 100%, 100%) - hsv(300, 100%, 100%)
- hsva(300, 100%, 100%, 1) - hsva(300, 100%, 100%, 1)
- #FF00FF - #ff00ff
- #F0F - #f0f
- magenta - magenta
- default: magenta - default: magenta
- inverse color: rgba(0, 255, 0, 1) - inverse color: rgba(0, 255, 0, 1)
...@@ -72,8 +72,8 @@ Dumping 'yellow' in different formats: ...@@ -72,8 +72,8 @@ Dumping 'yellow' in different formats:
- hsla(60, 100%, 50%, 1) - hsla(60, 100%, 50%, 1)
- hsv(60, 100%, 100%) - hsv(60, 100%, 100%)
- hsva(60, 100%, 100%, 1) - hsva(60, 100%, 100%, 1)
- #FFFF00 - #ffff00
- #FF0 - #ff0
- yellow - yellow
- default: yellow - default: yellow
- inverse color: rgba(0, 0, 255, 1) - inverse color: rgba(0, 0, 255, 1)
...@@ -85,8 +85,8 @@ Dumping 'white' in different formats: ...@@ -85,8 +85,8 @@ Dumping 'white' in different formats:
- hsla(0, 0%, 100%, 1) - hsla(0, 0%, 100%, 1)
- hsv(0, 0%, 100%) - hsv(0, 0%, 100%)
- hsva(0, 0%, 100%, 1) - hsva(0, 0%, 100%, 1)
- #FFFFFF - #ffffff
- #FFF - #fff
- white - white
- default: white - default: white
- inverse color: rgba(0, 0, 0, 1) - inverse color: rgba(0, 0, 0, 1)
...@@ -111,7 +111,7 @@ Dumping 'rgb(94, 126, 91)' in different formats: ...@@ -111,7 +111,7 @@ Dumping 'rgb(94, 126, 91)' in different formats:
- hsla(115, 16%, 43%, 1) - hsla(115, 16%, 43%, 1)
- hsv(115, 28%, 49%) - hsv(115, 28%, 49%)
- hsva(115, 28%, 49%, 1) - hsva(115, 28%, 49%, 1)
- #5E7E5B - #5e7e5b
- null - null
- null - null
- default: rgb(94, 126, 91) - default: rgb(94, 126, 91)
...@@ -137,7 +137,7 @@ Dumping 'hsl(212, 55%, 32%)' in different formats: ...@@ -137,7 +137,7 @@ Dumping 'hsl(212, 55%, 32%)' in different formats:
- hsla(212, 55%, 32%, 1) - hsla(212, 55%, 32%, 1)
- hsv(212, 71%, 50%) - hsv(212, 71%, 50%)
- hsva(212, 71%, 50%, 1) - hsva(212, 71%, 50%, 1)
- #254F7E - #254f7e
- null - null
- null - null
- default: hsl(212, 55%, 32%) - default: hsl(212, 55%, 32%)
...@@ -164,9 +164,9 @@ Dumping '#00FFFF' in different formats: ...@@ -164,9 +164,9 @@ Dumping '#00FFFF' in different formats:
- hsv(180, 100%, 100%) - hsv(180, 100%, 100%)
- hsva(180, 100%, 100%, 1) - hsva(180, 100%, 100%, 1)
- #00FFFF - #00FFFF
- #0FF - #0ff
- cyan - cyan
- default: #00FFFF - default: #00ffff
- inverse color: rgba(255, 0, 0, 1) - inverse color: rgba(255, 0, 0, 1)
- setAlpha(0.42): rgba(0, 255, 255, 0.42) - setAlpha(0.42): rgba(0, 255, 255, 0.42)
Dumping '#0FF' in different formats: Dumping '#0FF' in different formats:
...@@ -176,10 +176,10 @@ Dumping '#0FF' in different formats: ...@@ -176,10 +176,10 @@ Dumping '#0FF' in different formats:
- hsla(180, 100%, 50%, 1) - hsla(180, 100%, 50%, 1)
- hsv(180, 100%, 100%) - hsv(180, 100%, 100%)
- hsva(180, 100%, 100%, 1) - hsva(180, 100%, 100%, 1)
- #00FFFF - #00ffff
- #0FF - #0FF
- cyan - cyan
- default: #0FF - default: #0ff
- inverse color: rgba(255, 0, 0, 1) - inverse color: rgba(255, 0, 0, 1)
- setAlpha(0.42): rgba(0, 255, 255, 0.42) - setAlpha(0.42): rgba(0, 255, 255, 0.42)
...@@ -9,7 +9,7 @@ Running: editKeywordAsOriginal ...@@ -9,7 +9,7 @@ Running: editKeywordAsOriginal
1px solid red 1px solid red
Running: editKeywordAsHex Running: editKeywordAsHex
1px solid #F00 1px solid #f00
Running: editKeywordAsHSL Running: editKeywordAsHSL
1px solid hsl(0, 100%, 50%) 1px solid hsl(0, 100%, 50%)
...@@ -21,7 +21,7 @@ Running: editHexAsOriginal ...@@ -21,7 +21,7 @@ Running: editHexAsOriginal
#ffffee #ffffee
Running: editHexAsHex Running: editHexAsHex
#FFE #ffe
Running: editHexAsHSL Running: editHexAsHSL
hsl(60, 100%, 97%) hsl(60, 100%, 97%)
......
...@@ -4,9 +4,9 @@ Tests WebInspector.Spectrum ...@@ -4,9 +4,9 @@ Tests WebInspector.Spectrum
Testing: red Testing: red
red red
Testing: #ABC Testing: #ABC
#ABC #abc
Testing: #ABCDEF Testing: #ABCDEF
#ABCDEF #abcdef
Testing: rgb(1, 2, 3) Testing: rgb(1, 2, 3)
rgb(1, 2, 3) rgb(1, 2, 3)
Testing: rgba(1, 2, 3, 0.2) Testing: rgba(1, 2, 3, 0.2)
......
...@@ -7,8 +7,8 @@ color: red ...@@ -7,8 +7,8 @@ color: red
simple: true simple: true
original: red original: red
nickname: red nickname: red
hex: #FF0000 hex: #ff0000
shorthex: #F00 shorthex: #f00
rgb: rgb(255, 0, 0) rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%) hsl: hsl(0, 100%, 50%)
...@@ -16,7 +16,7 @@ color: #F00 ...@@ -16,7 +16,7 @@ color: #F00
simple: true simple: true
original: #F00 original: #F00
nickname: red nickname: red
hex: #FF0000 hex: #ff0000
shorthex: #F00 shorthex: #F00
rgb: rgb(255, 0, 0) rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%) hsl: hsl(0, 100%, 50%)
...@@ -25,8 +25,8 @@ color: rgb(255,0,0) ...@@ -25,8 +25,8 @@ color: rgb(255,0,0)
simple: true simple: true
original: rgb(255,0,0) original: rgb(255,0,0)
nickname: red nickname: red
hex: #FF0000 hex: #ff0000
shorthex: #F00 shorthex: #f00
rgb: rgb(255,0,0) rgb: rgb(255,0,0)
hsl: hsl(0, 100%, 50%) hsl: hsl(0, 100%, 50%)
...@@ -34,8 +34,8 @@ color: rgb(300,0,0) ...@@ -34,8 +34,8 @@ color: rgb(300,0,0)
simple: true simple: true
original: rgb(300,0,0) original: rgb(300,0,0)
nickname: red nickname: red
hex: #FF0000 hex: #ff0000
shorthex: #F00 shorthex: #f00
rgb: rgb(255, 0, 0) rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%) hsl: hsl(0, 100%, 50%)
...@@ -43,8 +43,8 @@ color: rgb(255,-10,0) ...@@ -43,8 +43,8 @@ color: rgb(255,-10,0)
simple: true simple: true
original: rgb(255,-10,0) original: rgb(255,-10,0)
nickname: red nickname: red
hex: #FF0000 hex: #ff0000
shorthex: #F00 shorthex: #f00
rgb: rgb(255, 0, 0) rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%) hsl: hsl(0, 100%, 50%)
...@@ -52,8 +52,8 @@ color: rgb(110%, 0%, 0%) ...@@ -52,8 +52,8 @@ color: rgb(110%, 0%, 0%)
simple: true simple: true
original: rgb(110%, 0%, 0%) original: rgb(110%, 0%, 0%)
nickname: red nickname: red
hex: #FF0000 hex: #ff0000
shorthex: #F00 shorthex: #f00
rgb: rgb(255, 0, 0) rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%) hsl: hsl(0, 100%, 50%)
...@@ -69,8 +69,8 @@ color: hsl(-120, 100%, 50%) ...@@ -69,8 +69,8 @@ color: hsl(-120, 100%, 50%)
simple: true simple: true
original: hsl(-120, 100%, 50%) original: hsl(-120, 100%, 50%)
nickname: blue nickname: blue
hex: #0000FF hex: #0000ff
shorthex: #00F shorthex: #00f
rgb: rgb(0, 0, 255) rgb: rgb(0, 0, 255)
hsl: hsl(-120, 100%, 50%) hsl: hsl(-120, 100%, 50%)
...@@ -78,8 +78,8 @@ color: hsl(-120, 200%, 200%) ...@@ -78,8 +78,8 @@ color: hsl(-120, 200%, 200%)
simple: true simple: true
original: hsl(-120, 200%, 200%) original: hsl(-120, 200%, 200%)
nickname: white nickname: white
hex: #FFFFFF hex: #ffffff
shorthex: #FFF shorthex: #fff
rgb: rgb(255, 255, 255) rgb: rgb(255, 255, 255)
hsl: hsl(-120, 200%, 200%) hsl: hsl(-120, 200%, 200%)
...@@ -120,7 +120,7 @@ color: hsl(200.5,0%,50%) ...@@ -120,7 +120,7 @@ color: hsl(200.5,0%,50%)
color: hsla(200,1.5%,50%,1) color: hsla(200,1.5%,50%,1)
simple: true simple: true
original: hsla(200,1.5%,50%,1) original: hsla(200,1.5%,50%,1)
hex: #7E8081 hex: #7e8081
rgb: rgb(126, 128, 129) rgb: rgb(126, 128, 129)
hsl: hsl(200, 1%, 50%) hsl: hsl(200, 1%, 50%)
...@@ -160,8 +160,8 @@ color: rgba(255, 0, 0, 5) ...@@ -160,8 +160,8 @@ color: rgba(255, 0, 0, 5)
simple: true simple: true
original: rgba(255, 0, 0, 5) original: rgba(255, 0, 0, 5)
nickname: red nickname: red
hex: #FF0000 hex: #ff0000
shorthex: #F00 shorthex: #f00
rgb: rgb(255, 0, 0) rgb: rgb(255, 0, 0)
hsl: hsl(0, 100%, 50%) hsl: hsl(0, 100%, 50%)
......
...@@ -80,7 +80,7 @@ WebInspector.Color.parse = function(text) ...@@ -80,7 +80,7 @@ WebInspector.Color.parse = function(text)
var match = value.match(simple); var match = value.match(simple);
if (match) { if (match) {
if (match[1]) { // hex if (match[1]) { // hex
var hex = match[1].toUpperCase(); var hex = match[1].toLowerCase();
var format; var format;
if (hex.length === 3) { if (hex.length === 3) {
format = WebInspector.Color.Format.ShortHEX; format = WebInspector.Color.Format.ShortHEX;
...@@ -327,11 +327,11 @@ WebInspector.Color.prototype = { ...@@ -327,11 +327,11 @@ WebInspector.Color.prototype = {
case WebInspector.Color.Format.HEX: case WebInspector.Color.Format.HEX:
if (this.hasAlpha()) if (this.hasAlpha())
return null; 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: case WebInspector.Color.Format.ShortHEX:
if (!this.canBeShortHex()) if (!this.canBeShortHex())
return null; 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: case WebInspector.Color.Format.Nickname:
return this.nickname(); return this.nickname();
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
"defaultValue": "original", "defaultValue": "original",
"options": [ "options": [
{ "title": "Set color format as authored", "text": "As authored", "value": "original" }, { "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 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 } { "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