diff --git a/lib/sass/value/color/space/rec2020.rb b/lib/sass/value/color/space/rec2020.rb index 29a3828e..d0571d33 100644 --- a/lib/sass/value/color/space/rec2020.rb +++ b/lib/sass/value/color/space/rec2020.rb @@ -8,16 +8,6 @@ module Space class Rec2020 include Space - # A constant used in the rec2020 gamma encoding/decoding functions. - ALPHA = 1.09929682680944 - - private_constant :ALPHA - - # A constant used in the rec2020 gamma encoding/decoding functions. - BETA = 0.018053968510807 - - private_constant :BETA - def bounded? true end @@ -27,13 +17,11 @@ def initialize end def to_linear(channel) - abs = channel.abs - abs < BETA * 4.5 ? channel / 4.5 : (channel <=> 0) * (((abs + ALPHA - 1) / ALPHA)**(1 / 0.45)) + (channel <=> 0) * (channel.abs**2.4) end def from_linear(channel) - abs = channel.abs - abs > BETA ? (channel <=> 0) * ((ALPHA * (abs**0.45)) - (ALPHA - 1)) : 4.5 * channel + (channel <=> 0) * (channel.abs**(1 / 2.4)) end private diff --git a/spec/sass/value/color/interpolation_examples.rb b/spec/sass/value/color/interpolation_examples.rb index 08135567..a2d88df9 100644 --- a/spec/sass/value/color/interpolation_examples.rb +++ b/spec/sass/value/color/interpolation_examples.rb @@ -263,19 +263,19 @@ { weight: 0.5 }, - [0.5494120530883964, 0.4907232619435038, 0.5681615893671463] + [0.6077246048987993, 0.560474374484174, 0.6287869996304708] ], [ { weight: 1 }, - [0.8837118321235519, 0.6578067923850563, 0.7273197917658354] + [0.901652581777482, 0.7080066863855734, 0.7679984285088408] ], [ { weight: 0 }, - [0.21511227405324085, 0.32363973150195124, 0.4090033869684574] + [0.3137966280201166, 0.4129420625827747, 0.48957557075210073] ] ], xyz: [ diff --git a/spec/sass/value/color/spaces.rb b/spec/sass/value/color/spaces.rb index 82ce227f..c882e50e 100644 --- a/spec/sass/value/color/spaces.rb +++ b/spec/sass/value/color/spaces.rb @@ -223,8 +223,8 @@ def respond_to_missing?(symbol, _include_all) name: 'rec2020', is_legacy: false, is_polar: false, - pink: [0.883711832123552, 0.6578067923850561, 0.7273197917658352], - blue: [0.21511227405324085, 0.3236397315019512, 0.4090033869684574], + pink: [0.901652581777482, 0.7080066863855734, 0.7679984285088408], + blue: [0.3137966280201166, 0.4129420625827747, 0.48957557075210073], channels: %w[red green blue], ranges: [ [0, 1],