Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions docs/ui/src/js/createOutputParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ let ${themeName.replace(/[^a-zA-Z0-9_$]/g, '_')} = new Leo.Theme({
lightness: ${_theme.lightness},
contrast: ${_theme.contrast},
saturation: ${_theme.saturation},
output: "${_theme.output},"
output: "${_theme.output}",
formula: "${_theme.formula}"
});`;

Expand Down Expand Up @@ -115,26 +115,30 @@ function createTokensOutput() {
let backgroundColor = _theme.contrastColors[0].background;

let backgroundColorObj = {
value: backgroundColor,
type: 'color',
description: `UI background color. All color contrasts evaluated and generated against this color.`
$value: backgroundColor,
$type: 'color',
$description: `UI background color. All color contrasts evaluated and generated against this color.`
};
themeObj['Background'] = backgroundColorObj;

let formulaString = _theme.formula === 'wcag2' ? 'WCAG 2.x (relative luminance)' : 'WCAG 3 (APCA)';
let largeText = _theme.formula === 'wcag3' ? 60 : 3;
let smallText = _theme.formula === 'wcag3' ? 75 : 4.5;

let formulaString = _theme.formula === 'wcag2' ? 'WCAG 2.x (relative luminance)' : 'WCAG 3 (APCA)';
let largeText = _theme.formula === 'wcag3' ? 60 : 3;
let smallText = _theme.formula === 'wcag3' ? 75 : 4.5;

for (let i = 1; i < contrastColors.length; i++) {
let thisColor = contrastColors[i];
for (let j = 0; j < thisColor.values.length; j++) {
let color = thisColor.values[j];
let descriptionText = color.contrast < largeText ? textLowContrast : color.contrast >= largeText && color.contrast < smallText ? textLarge : textSmall;

let colorObj = {
value: color.value,
type: 'color',
description: `${descriptionText} ${formulaString} contrast is ${color.contrast}:1 against background ${backgroundColor}`
$value: color.value,
$type: 'color',
$description: `${descriptionText} ${formulaString} contrast is ${color.contrast}:1 against background ${backgroundColor}`
};
themeObj[color.name] = colorObj;
}
Expand Down
5 changes: 0 additions & 5 deletions packages/contrast-colors/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,6 @@ function convertColorValue(color, format, object = false) {
if (letter === 'l' || letter === 'j') {
rnd += '%';
}
if (letter === 'h') {
rnd += 'deg';
}
}
} else if (space !== 'hsluv') {
if (letter === 's' || letter === 'l' || letter === 'v') {
Expand All @@ -363,8 +360,6 @@ function convertColorValue(color, format, object = false) {
rnd = round(ch * 100);
rnd += '%';
}
} else if (letter === 'h' && !object) {
rnd += 'deg';
}
}
return rnd;
Expand Down
Loading
Loading