Skip to content

Commit

Permalink
Update relative luminance sRGB threshold (#783)
Browse files Browse the repository at this point in the history
Use the corrected value being included in WCAG 2.2 spec - Reference: w3c/wcag#1780
As stated in the update that there should be "no practical effect on the calculations" - as can be seen by the minor adjustments in precision
  • Loading branch information
mbrambilla committed Nov 4, 2021
1 parent aaf3005 commit a05b068
Showing 1 changed file with 36 additions and 33 deletions.
69 changes: 36 additions & 33 deletions scss/functions/_color-util.scss
Expand Up @@ -156,10 +156,13 @@
// Lookup table for channel color values in sRGB space
// Needed since SASS does not have exponentiation or `pow`.
//
// Updated threshold (0.03928 --> 0.04045) based on WCAG 2.2 spec:
// https://github.com/w3c/wcag/pull/1780
//
// Generated via the following JavaScript:
// for (var i = 0; i < 256; i++) {
// var c = i / 255;
// var v = (c < 0.03928) ? (c / 12.92) : Math.pow((c + 0.055) / 1.055, 2.4);
// var v = (c < 0.04045) ? (c / 12.92) : Math.pow((c + 0.055) / 1.055, 2.4);
// console.log(v);
// }
// stylelint-disable-next-line scss/dollar-variable-default, scss/dollar-variable-colon-space-after
Expand All @@ -182,17 +185,17 @@ $color-channel-lookup:
.004776953480693729
.005181516702338386
.005605391624202723
.006048833022857054
.006512090792594475
.006048833022857055
.006512090792594474
.006995410187265387
.007499032043226175
.008023192985384994
.008568125618069307
.009134058702220787
.009721217320237847
.010329823029626936
.010329823029626938
.010960094006488246
.011612245179743885
.011612245179743887
.012286488356915872
.012983032342173012
.013702083047289686
Expand All @@ -203,30 +206,30 @@ $color-channel-lookup:
.017641954488384078
.018500220128379697
.019382360956935723
.020288563056652397
.021219010376003555
.0202885630566524
.021219010376003558
.02217388479338738
.02315336617811041
.024157632448504756
.02518685962736163
.025186859627361627
.026241221894849898
.027320891639074897
.028426039504420793
.029556834437808804
.0295568344378088
.030713443732993635
.03189603307301153
.033104766570885055
.03433980680868217
.03560131487502034
.03688945040110004
.0382043715953465
.03954623527673284
.03954623527673283
.04091519690685319
.042311410620809675
.043735029256973465
.04518620438567554
.046665086336880095
.04817182422688942
.0466650863368801
.048171824226889426
.04970656598412723
.05126945837404324
.052860647023180246
Expand All @@ -239,24 +242,24 @@ $color-channel-lookup:
.06480326669290577
.06662593864377289
.06847816984440017
.07036009569659589
.07036009569659588
.07227185068231748
.07421356838014963
.07618538148130784
.07618538148130785
.07818742180518633
.08021982031446832
.08021982031446831
.0822827071298148
.08437621154414882
.08650046203654976
.08865558628577294
.09084171118340768
.09305896284668745
.09084171118340767
.09305896284668747
.0953074666309647
.09758734714186246
.09989872824711389
.10224173308810132
.1022417330881013
.10461648409110419
.10702310297826763
.10702310297826761
.10946171077829933
.1119324278369056
.11443537382697373
Expand All @@ -276,27 +279,27 @@ $color-channel-lookup:
.15292615199615017
.1559264637078274
.1589608350608804
.162029375639111
.16202937563911096
.1651321945016676
.16826940018969075
.1714411007328226
.17464740365558504
.17788841598362912
.17788841598362914
.18116424424986022
.184474994500441
.18782077230067787
.19120168274079138
.1946178304415758
.1912016827407914
.19461783044157582
.19806931955994886
.20155625379439707
.20507873639031693
.20863687014525575
.21223075741405523
.21586050011389923
.2195261997292692
.21952619972926923
.2232279573168085
.22696587351009836
.23074004852434912
.23074004852434915
.23455058216100522
.238397573812271
.24228112246555486
Expand All @@ -322,7 +325,7 @@ $color-channel-lookup:
.3277780980565422
.33245153634617935
.33716361504833037
.3419144249086609
.341914424908661
.3467040563550296
.35153259950043936
.3564001441459435
Expand All @@ -340,9 +343,9 @@ $color-channel-lookup:
.4178850708481375
.4232676699860717
.4286904966139067
.43415363617474895
.4341536361747489
.4396571738409188
.4452011945162279
.44520119451622786
.45078578283822346
.45641102318040466
.4620769996544071
Expand Down Expand Up @@ -376,22 +379,22 @@ $color-channel-lookup:
.6375968739940326
.6444796819705821
.6514056374198242
.6583748172794485
.6583748172794486
.665387298282272
.6724431569576875
.6795424696330938
.6866853124353135
.6866853124353134
.6938717612919899
.7011018919329731
.7083757798916869
.7083757798916868
.7156935005064807
.7230551289219693
.7304607400903537
.7379104087727308
.7454042095403874
.7529422167760779
.7605245046752924
.768151147247507
.7681511472475071
.7758222183174236
.7835377915261935
.7912979403326302
Expand All @@ -404,7 +407,7 @@ $color-channel-lookup:
.846873231509858
.8549926081242338
.8631572134541023
.8713671191987972
.8713671191987973
.8796223968878317
.8879231178819663
.8962693533742664
Expand Down

0 comments on commit a05b068

Please sign in to comment.