File tree Expand file tree Collapse file tree 2 files changed +3
-8
lines changed
Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -136,9 +136,9 @@ export function formatLch(color: AnyLch): string {
136136 let { alpha, c, h, l } = color
137137 let postfix = ''
138138 if ( typeof alpha !== 'undefined' && alpha < 1 ) {
139- postfix = ` / ${ toPercent ( alpha ) } `
139+ postfix = ` / ${ clean ( 100 * alpha ) } % `
140140 }
141- return `${ COLOR_FN } (${ toPercent ( l / L_MAX ) } ${ c } ${ h } ${ postfix } )`
141+ return `${ COLOR_FN } (${ clean ( l / L_MAX ) } ${ c } ${ h } ${ postfix } )`
142142}
143143
144144// Hack to avoid ,999999 because of float bug implementation
@@ -149,10 +149,6 @@ export function clean(value: number, precision = 2): number {
149149 )
150150}
151151
152- export function toPercent ( value : number ) : string {
153- return `${ clean ( 100 * value ) } %`
154- }
155-
156152export function isHexNotation ( value : string ) : boolean {
157153 return / ^ # ? ( [ \d a - f ] { 3 } | [ \d a - f ] { 4 } | [ \d a - f ] { 6 } | [ \d a - f ] { 8 } ) $ / i. test ( value )
158154}
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ import {
2020 lrgb ,
2121 oklab ,
2222 p3 ,
23- toPercent ,
2423 toRgb
2524} from '../lib/colors.ts'
2625import { current , valueToColor } from './current.ts'
@@ -32,7 +31,7 @@ function formatOklab(color: Oklab): string {
3231 if ( typeof alpha !== 'undefined' && alpha < 1 ) {
3332 postfix = ` / ${ clean ( alpha ) } `
3433 }
35- return `oklab(${ toPercent ( l ) } ${ clean ( a ) } ${ clean ( b ) } ${ postfix } )`
34+ return `oklab(${ clean ( l ) } ${ clean ( a ) } ${ clean ( b ) } ${ postfix } )`
3635}
3736
3837function formatVec ( color : AnyRgb ) : string {
You can’t perform that action at this time.
0 commit comments