From 41b0d0497988274057fc2512c822a6bc9d2d3ebd Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 6 Aug 2025 16:40:56 +0200 Subject: Switch to tab indentation --- src/_apca.scss | 172 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 86 insertions(+), 86 deletions(-) (limited to 'src/_apca.scss') diff --git a/src/_apca.scss b/src/_apca.scss index c65f46e..c5da4a0 100644 --- a/src/_apca.scss +++ b/src/_apca.scss @@ -7,121 +7,121 @@ @use 'sass:math'; $SA98G: ( - mainTRC: 2.4, - - sRco: .2126729, - sGco: .7151522, - sBco: .072175, - - normBG: .56, - normTXT: .57, - revTXT: .62, - revBG: .65, - - blkThrs: .022, - blkClmp: 1.414, - scaleBoW: 1.14, - scaleWoB: 1.14, - loBoWoffset: .027, - loWoBoffset: .027, - deltaYmin: .0005, - loClip: .0001, - - mFactor: 1.9468554433171, - mOffsetIn: .0387393816571401, - mExpAdj: .283343396420869, - mOffsetOut: .312865795870758, + mainTRC: 2.4, + + sRco: .2126729, + sGco: .7151522, + sBco: .072175, + + normBG: .56, + normTXT: .57, + revTXT: .62, + revBG: .65, + + blkThrs: .022, + blkClmp: 1.414, + scaleBoW: 1.14, + scaleWoB: 1.14, + loBoWoffset: .027, + loWoBoffset: .027, + deltaYmin: .0005, + loClip: .0001, + + mFactor: 1.9468554433171, + mOffsetIn: .0387393816571401, + mExpAdj: .283343396420869, + mOffsetOut: .312865795870758, ); @function sRGB_to_Y($color) { - $rgb: color.to-space($color, rgb); + $rgb: color.to-space($color, rgb); - @return map.get($SA98G, sRco) * math.pow(math.div(color.channel($rgb, 'red'), 255), map.get($SA98G, mainTRC)) + - map.get($SA98G, sGco) * math.pow(math.div(color.channel($rgb, 'green'), 255), map.get($SA98G, mainTRC)) + - map.get($SA98G, sBco) * math.pow(math.div(color.channel($rgb, 'blue'), 255), map.get($SA98G, mainTRC)); + @return map.get($SA98G, sRco) * math.pow(math.div(color.channel($rgb, 'red'), 255), map.get($SA98G, mainTRC)) + + map.get($SA98G, sGco) * math.pow(math.div(color.channel($rgb, 'green'), 255), map.get($SA98G, mainTRC)) + + map.get($SA98G, sBco) * math.pow(math.div(color.channel($rgb, 'blue'), 255), map.get($SA98G, mainTRC)); } @function Y_to_sRGB($y) { - $c: math.round(math.pow($y, math.div(1, map.get($SA98G, mainTRC))) * 255); - @return rgb($c, $c, $c); + $c: math.round(math.pow($y, math.div(1, map.get($SA98G, mainTRC))) * 255); + @return rgb($c, $c, $c); } @function contrast($txtY, $bgY) { - /* stylelint-disable-next-line @stylistic/number-no-trailing-zeros */ - $icp: .0 1.1; + /* stylelint-disable-next-line @stylistic/number-no-trailing-zeros */ + $icp: .0 1.1; - @if math.min($txtY, $bgY) < list.nth($icp, 1) or math.max($txtY, $bgY) > list.nth($icp, 2) { - @return 0; - } + @if math.min($txtY, $bgY) < list.nth($icp, 1) or math.max($txtY, $bgY) > list.nth($icp, 2) { + @return 0; + } - @if $txtY <= map.get($SA98G, blkThrs) { - $txtY: $txtY + math.pow(map.get($SA98G, blkThrs) - $txtY, map.get($SA98G, blkClmp)); - } - @if $bgY <= map.get($SA98G, blkThrs) { - $bgY: $bgY + math.pow(map.get($SA98G, blkThrs) - $bgY, map.get($SA98G, blkClmp)); - } + @if $txtY <= map.get($SA98G, blkThrs) { + $txtY: $txtY + math.pow(map.get($SA98G, blkThrs) - $txtY, map.get($SA98G, blkClmp)); + } + @if $bgY <= map.get($SA98G, blkThrs) { + $bgY: $bgY + math.pow(map.get($SA98G, blkThrs) - $bgY, map.get($SA98G, blkClmp)); + } - @if math.abs($bgY - $txtY) < map.get($SA98G, deltaYmin) { - @return 0; - } + @if math.abs($bgY - $txtY) < map.get($SA98G, deltaYmin) { + @return 0; + } - $outputContrast: 0; + $outputContrast: 0; - @if $bgY > $txtY { - $SAPC: map.get($SA98G, scaleBoW) * (math.pow($bgY, map.get($SA98G, normBG)) - math.pow($txtY, map.get($SA98G, normTXT))); + @if $bgY > $txtY { + $SAPC: map.get($SA98G, scaleBoW) * (math.pow($bgY, map.get($SA98G, normBG)) - math.pow($txtY, map.get($SA98G, normTXT))); - @if $SAPC >= map.get($SA98G, loClip) { - $outputContrast: $SAPC - map.get($SA98G, loBoWoffset); - } - } @else { - $SAPC: map.get($SA98G, scaleWoB) * (math.pow($bgY, map.get($SA98G, revBG)) - math.pow($txtY, map.get($SA98G, revTXT))); + @if $SAPC >= map.get($SA98G, loClip) { + $outputContrast: $SAPC - map.get($SA98G, loBoWoffset); + } + } @else { + $SAPC: map.get($SA98G, scaleWoB) * (math.pow($bgY, map.get($SA98G, revBG)) - math.pow($txtY, map.get($SA98G, revTXT))); - @if $SAPC <= -1 * map.get($SA98G, loClip) { - $outputContrast: $SAPC + map.get($SA98G, loWoBoffset); - } - } + @if $SAPC <= -1 * map.get($SA98G, loClip) { + $outputContrast: $SAPC + map.get($SA98G, loWoBoffset); + } + } - @return $outputContrast * 100; + @return $outputContrast * 100; } @function reverse($contrast, $knownY, $knownType: 'bg') { - $unknownY: $knownY; + $unknownY: $knownY; - $knownExp: 0; - $unknownExp: 0; + $knownExp: 0; + $unknownExp: 0; - $scale: map.get($SA98G, if($contrast > 0, scaleBoW, scaleWoB)); - $offset: map.get($SA98G, if($contrast > 0, loBoWoffset, loWoBoffset)); + $scale: map.get($SA98G, if($contrast > 0, scaleBoW, scaleWoB)); + $offset: map.get($SA98G, if($contrast > 0, loBoWoffset, loWoBoffset)); - $contrast: math.div($contrast * .01 + $offset, $scale); + $contrast: math.div($contrast * .01 + $offset, $scale); - @if $knownY <= map.get($SA98G, blkThrs) { - $knownY: $knownY + math.pow(map.get($SA98G, blkThrs) - $knownY, map.get($SA98G, blkClmp)); - } + @if $knownY <= map.get($SA98G, blkThrs) { + $knownY: $knownY + math.pow(map.get($SA98G, blkThrs) - $knownY, map.get($SA98G, blkClmp)); + } - @if $knownType == 'bg' { - $knownExp: map.get($SA98G, if($contrast > 0, normBG, revBG)); - $unknownExp: map.get($SA98G, if($contrast > 0, normTXT, revTXT)); - $unknownY: math.pow(math.pow($knownY, $knownExp) - $contrast, math.div(1, $unknownExp)); - } @else { - $knownExp: map.get($SA98G, if($contrast > 0, normTXT, revTXT)); - $unknownExp: map.get($SA98G, if($contrast > 0, normBG, revBG)); - $unknownY: math.pow($contrast + math.pow($knownY, $knownExp), math.div(1, $unknownExp)); - } + @if $knownType == 'bg' { + $knownExp: map.get($SA98G, if($contrast > 0, normBG, revBG)); + $unknownExp: map.get($SA98G, if($contrast > 0, normTXT, revTXT)); + $unknownY: math.pow(math.pow($knownY, $knownExp) - $contrast, math.div(1, $unknownExp)); + } @else { + $knownExp: map.get($SA98G, if($contrast > 0, normTXT, revTXT)); + $unknownExp: map.get($SA98G, if($contrast > 0, normBG, revBG)); + $unknownY: math.pow($contrast + math.pow($knownY, $knownExp), math.div(1, $unknownExp)); + } - @if '#{$unknownY}' == '#{math.sqrt(-1)}' { - @return false; - } + @if '#{$unknownY}' == '#{math.sqrt(-1)}' { + @return false; + } - @if $unknownY > 1.06 or $unknownY < 0 { - @return false; - } + @if $unknownY > 1.06 or $unknownY < 0 { + @return false; + } - @if $unknownY <= map.get($SA98G, blkThrs) { - $unknownY: math.pow(($unknownY + map.get($SA98G, mOffsetIn)) * map.get($SA98G, mFactor), math.div(map.get($SA98G, mExpAdj), map.get($SA98G, blkClmp))) * math.div(1, map.get($SA98G, mFactor)) - map.get($SA98G, mOffsetOut); - } + @if $unknownY <= map.get($SA98G, blkThrs) { + $unknownY: math.pow(($unknownY + map.get($SA98G, mOffsetIn)) * map.get($SA98G, mFactor), math.div(map.get($SA98G, mExpAdj), map.get($SA98G, blkClmp))) * math.div(1, map.get($SA98G, mFactor)) - map.get($SA98G, mOffsetOut); + } - $unknownY: math.max(math.min($unknownY, 1), 0); + $unknownY: math.max(math.min($unknownY, 1), 0); - @return $unknownY; + @return $unknownY; } -- cgit v1.2.3-70-g09d2