Files
bbedward 014c69b09a settings: tile color restyle and re-org, use materials own shift for
them towards theme
controlCenter: make a real grid, add numerous more tile varieties, add
icon size option
surfaces: fix elevation levels in general, and shift them down
settings: restyles and re-org
sliders: scale down universally
2026-09-18 14:32:55 -04:00

27 lines
836 B
JavaScript

.pragma library
var MIN_CHANNEL_DELTA = 0.1;
function distinct(a, b) {
const ca = Qt.color(a);
const cb = Qt.color(b);
return Math.max(Math.abs(ca.r - cb.r), Math.abs(ca.g - cb.g), Math.abs(ca.b - cb.b)) >= MIN_CHANNEL_DELTA;
}
function firstDistinct(candidates, taken) {
return candidates.find(c => c && taken.every(t => distinct(c, t)));
}
function pick(scheme) {
if (!scheme?.primary)
return null;
const primary = scheme.primary;
const secondary = firstDistinct([scheme.secondary, scheme.tertiary, scheme.primaryContainer, scheme.info], [primary]) ?? primary;
const tertiary = firstDistinct([scheme.tertiary, scheme.info, scheme.error, scheme.warning, scheme.primaryContainer], [primary, secondary]) ?? secondary;
return {
primary,
secondary,
tertiary
};
}