export parseHex, relativeLuminance, softLightSurface for testing
This commit is contained in:
1 parent
ebd2ff131c
commit
02abf8f88c
1 file changed
+3
-3
@@ -28,7 +28,7 @@ export interface AdminPalette {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Pure / near-white public surfaces → soft admin paper (less eye strain). */
|
/** Pure / near-white public surfaces → soft admin paper (less eye strain). */
|
||||||
function softLightSurface(
|
export function softLightSurface(
|
||||||
value: string | undefined,
|
value: string | undefined,
|
||||||
softDefault: string,
|
softDefault: string,
|
||||||
): string {
|
): string {
|
||||||
@@ -262,7 +262,7 @@ export function ensureReadableThemeColors(
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseHex(value: string): Rgb | null {
|
export function parseHex(value: string): Rgb | null {
|
||||||
const trimmed = value.trim();
|
const trimmed = value.trim();
|
||||||
const short = /^#([0-9a-f]{3})$/i.exec(trimmed);
|
const short = /^#([0-9a-f]{3})$/i.exec(trimmed);
|
||||||
if (short) {
|
if (short) {
|
||||||
@@ -282,7 +282,7 @@ function parseHex(value: string): Rgb | null {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function relativeLuminance(rgb: Rgb): number {
|
export function relativeLuminance(rgb: Rgb): number {
|
||||||
const [red, green, blue] = rgb.map((channel) => {
|
const [red, green, blue] = rgb.map((channel) => {
|
||||||
const value = channel / 255;
|
const value = channel / 255;
|
||||||
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
||||||
|
|||||||
Reference in new issue
Block a user