JDK-8294090 : Aligns the CSS <rgb()>
and <rgba()>
function behaviours
#16
Labels
Enhancement
New feature or request
Fixed
Fixed issue.
Reporter
Reported this Issue to Java Bug DataBase
WIP
Work In Progress
The purpose of this issue is to align the
<rgb()>
and<rgba()>
function behaviours in CSS.java.This is referenced in Java Bug Database as
<rgb()>
and<rgba()>
function behavioursThis is tracked in JBS as
<rgb()>
and<rgba()>
function behavioursRelated Pull Request
<rgb()>
and<rgba()>
function behavioursAligns the
<rgb()>
and<rgba()>
function behaviours in CSS.java, as described in :CSS Color Module Level 4
W3C Candidate Recommendation Snapshot, 5 July 2022
4.1 The
<Color>
syntax6.1. The RGB functions: rgb() and rgba()
<number>
typeStatus
This Enhancement Request is not yet accepted so it's internaly referenced in Java Bug Database as JI-9073933.Basic test
jshell
type :Expected result, a value not an Exception.
Expected result, 240.
Details :
()
multiple white-space (according to Java) occurences are replaced by only one space character.rgb
orrgba
and(
are removed./
is not present,<rgb>
functions need 3 values. Not verified.none
keyword not scaned.number
used as value is not defined in the specification. Then implementations should use the previous implementation format.Consequences
<rgba>
accepts most of these functionalities excepted % for alpha value. According comments above, implementation doesn't respect the alpha range and treates this component like r, g, b. It's a bug.<rgb>
doesn't accept alpha value. It's an enhancement.none
keyword not supported. It's an enhancement.number
used as value isJava
float
s
is sign, 1 bitm
is magnitude 23 bitse
is exponent 8 bitsSyntax
rgb()
rgb( [<percentage> | none]{3} [ / [<alpha-value> | none] ]? )
rgb( [<number> | none]{3} [ / [<alpha-value> | none] ]? )
rgb( <percentage>#{3} , <alpha-value>? )
rgb( <number>#{3} , <alpha-value>? )
number:= [+|-]? [0...9]* [[. [0...9]*]]? [[e|E]! [0...9]*]?
Some tests
rgb(12 24 200)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(-1 24 200%)
java.awt.Color[r=0,g=24,b=255] + a=255
rgba(0 24 255 1.0)
rgb(300 24 28)
java.awt.Color[r=255,g=24,b=28] + a=255
rgba(255 24 28 1.0)
rgb(12 24 200 / 82%)
java.awt.Color[r=12,g=24,b=200] + a=209
rgba(12 24 200 0.82)
rgb(12 24 200 / 0.82)
java.awt.Color[r=12,g=24,b=200] + a=209
rgba(12 24 200 0.82)
rgb(12 24 200 / -210)
java.awt.Color[r=12,g=24,b=200] + a=0
rgba(12 24 200 0.0)
rgb(12, 24, 200)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12, 24, 200, 210)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12, 24, 200 , 210)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12 , 24 , 200 , 210)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb( 12 , 24 , 200 , 210 )
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12 ,24, 200 ,210)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12,24,200,210)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(15% 60% 49%)
java.awt.Color[r=38,g=153,b=125] + a=255
rgba(38 153 125 1.0)
rgb(15% 60% 49% / 82%)
java.awt.Color[r=38,g=153,b=125] + a=209
rgba(38 153 125 0.82)
rgb(15%, 60%, 49% / 82%)
java.awt.Color[r=38,g=153,b=125] + a=209
rgba(38 153 125 0.82)
rgb(0.14 60% 52.3 / 0.98)
java.awt.Color[r=0,g=153,b=52] + a=250
rgba(0 153 52 0.98)
rgb(none none none)
java.awt.Color[r=0,g=0,b=0] + a=255
rgba(0 0 0 1.0)
rgb(none none none / none)
java.awt.Color[r=0,g=0,b=0] + a=0
rgba(0 0 0 0.0)
rgb(none none none / none)
java.awt.Color[r=0,g=0,b=0] + a=0
rgba(0 0 0 0.0)
rgb(none none 30)
java.awt.Color[r=0,g=0,b=30] + a=255
rgba(0 0 30 1.0)
rgb(none 20 none)
java.awt.Color[r=0,g=20,b=0] + a=255
rgba(0 20 0 1.0)
rgb(10 none none)
java.awt.Color[r=10,g=0,b=0] + a=255
rgba(10 0 0 1.0)
rgb(none none none)
java.awt.Color[r=0,g=0,b=0] + a=255
rgba(0 0 0 1.0)
rgb(10 50 13% / 50%)
java.awt.Color[r=10,g=50,b=33] + a=128
rgba(10 50 33 0.5)
rgb(10 50 13% // 50%)
java.awt.Color[r=0,g=0,b=0] + a=255
rgba(0 0 0 1.0)
rgb(10 50,, 13% // 50%)
java.awt.Color[r=0,g=0,b=0] + a=255
rgba(0 0 0 1.0)
rgb(10 50 ,, 13% // 50%)
java.awt.Color[r=0,g=0,b=0] + a=255
rgba(0 0 0 1.0)
rgb(1.2e1 0.24e2 2e2)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(1200e-2 2400e-2 200000e-3)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12 24 200)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12 24 200%)
java.awt.Color[r=12,g=24,b=255] + a=255
rgba(12 24 255 1.0)
rgb(-1 24 200%)
java.awt.Color[r=0,g=24,b=255] + a=255
rgba(0 24 255 1.0)
rgb(300 24 28)
java.awt.Color[r=255,g=24,b=28] + a=255
rgba(255 24 28 1.0)
rgb(12 24 200 / 82%)
java.awt.Color[r=12,g=24,b=200] + a=209
rgba(12 24 200 0.82)
rgb(12 24 200 / 0.82)
java.awt.Color[r=12,g=24,b=200] + a=209
rgba(12 24 200 0.82)
rgb(12 24 200 / -210)
java.awt.Color[r=12,g=24,b=200] + a=0
rgba(12 24 200 0.0)
rgb(12, 24, 200)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12, 24, 200, 210)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12, 24, 200 , 210)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12 , 24 , 200 , 210)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb( 12 , 24 , 200 , 210 )
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12 ,24, 200 ,210)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(12,24,200,210)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(15% 60% 49%)
java.awt.Color[r=38,g=153,b=125] + a=255
rgba(38 153 125 1.0)
rgb(15% 60% 49% / 82%)
java.awt.Color[r=38,g=153,b=125] + a=209
rgba(38 153 125 0.82)
rgb(15%, 60%, 49% / 82%)
java.awt.Color[r=38,g=153,b=125] + a=209
rgba(38 153 125 0.82)
rgb(0.14 60% 52.3 / 0.98)
java.awt.Color[r=0,g=153,b=52] + a=250
rgba(0 153 52 0.98)
rgb(none none none)
java.awt.Color[r=0,g=0,b=0] + a=255
rgba(0 0 0 1.0)
rgb(none none none / none)
java.awt.Color[r=0,g=0,b=0] + a=0
rgba(0 0 0 0.0)
rgb(none none none/none)
java.awt.Color[r=0,g=0,b=0] + a=0
rgba(0 0 0 0.0)
rgb(none none 30)
java.awt.Color[r=0,g=0,b=30] + a=255
rgba(0 0 30 1.0)
rgb(none 20 none)
java.awt.Color[r=0,g=20,b=0] + a=255
rgba(0 20 0 1.0)
rgb(10 none none)
java.awt.Color[r=10,g=0,b=0] + a=255
rgba(10 0 0 1.0)
rgb(none none none)
java.awt.Color[r=0,g=0,b=0] + a=255
rgba(0 0 0 1.0)
rgb(10 50 13% / 50%)
java.awt.Color[r=10,g=50,b=33] + a=128
rgba(10 50 33 0.5)
rgb(10 50 13% // 50%)
java.awt.Color[r=0,g=0,b=0] + a=255
rgba(0 0 0 1.0)
rgb(10 50,, 13% // 50%)
java.awt.Color[r=0,g=0,b=0] + a=255
rgba(0 0 0 1.0)
rgb(10 50 ,, 13% // 50%)
java.awt.Color[r=0,g=0,b=0] + a=255
rgba(0 0 0 1.0)
rgb(1.2e1 0.24e2 2e2)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(1200e-2 2400e-2 200000e-3)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
rgb(120560.64646464632469823160676064670646798706406464098706464097970906464067e-4 2400e-2 200000e-3)
java.awt.Color[r=12,g=24,b=200] + a=255
rgba(12 24 200 1.0)
About performances
<rgb>
alpha support<rgb>
none
support<rgb>
base-ten floating-point notation support✔️
The text was updated successfully, but these errors were encountered: