@electrovir/color 1.7.2 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CSSResult } from 'element-vir';
|
|
2
|
+
import { type SingleCssVarDefinition } from 'lit-css-vars';
|
|
3
|
+
/**
|
|
4
|
+
* A foreground/background color pair.
|
|
5
|
+
*
|
|
6
|
+
* @category Internal
|
|
7
|
+
*/
|
|
8
|
+
export type ColorPair = Record<'foreground' | 'background', SingleCssVarDefinition>;
|
|
9
|
+
/**
|
|
10
|
+
* Creates foreground and background CSS code. The foreground color is applied to the CSS `color`
|
|
11
|
+
* property and the background color is applied to the CSS `background-color` property.
|
|
12
|
+
*
|
|
13
|
+
* @category Color Theme
|
|
14
|
+
*/
|
|
15
|
+
export declare function colorCss(color: Readonly<ColorPair>): CSSResult;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { css } from 'element-vir';
|
|
2
|
+
/**
|
|
3
|
+
* Creates foreground and background CSS code. The foreground color is applied to the CSS `color`
|
|
4
|
+
* property and the background color is applied to the CSS `background-color` property.
|
|
5
|
+
*
|
|
6
|
+
* @category Color Theme
|
|
7
|
+
*/
|
|
8
|
+
export function colorCss(color) {
|
|
9
|
+
return css `
|
|
10
|
+
color: ${color.foreground.value};
|
|
11
|
+
background-color: ${color.background.value};
|
|
12
|
+
`;
|
|
13
|
+
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ColorPair } from '../data/color-css.js';
|
|
2
2
|
import { type FontWeight } from '../data/contrast/contrast.js';
|
|
3
|
-
/**
|
|
4
|
-
* A foreground/background color pair.
|
|
5
|
-
*
|
|
6
|
-
* @category Internal
|
|
7
|
-
*/
|
|
8
|
-
export type ColorPair = Record<'foreground' | 'background', SingleCssVarDefinition>;
|
|
9
3
|
/**
|
|
10
4
|
* Showcase a foreground/backend color pair.
|
|
11
5
|
*
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { assertWrap, check } from '@augment-vir/assert';
|
|
3
3
|
import { css, defineElement, html, listen, nothing, onDomCreated, unsafeCSS } from 'element-vir';
|
|
4
4
|
import { noNativeFormStyles, noNativeSpacing, viraFontCssVars } from 'vira';
|
|
5
|
+
import { colorCss } from '../data/color-css.js';
|
|
5
6
|
import { calculateContrast } from '../data/contrast/contrast.js';
|
|
6
7
|
import { VirContrastIndicator } from './vir-contrast-indicator.element.js';
|
|
7
8
|
/**
|
|
@@ -167,10 +168,7 @@ export const VirColorPair = defineElement()({
|
|
|
167
168
|
});
|
|
168
169
|
})}
|
|
169
170
|
class="color-preview"
|
|
170
|
-
style=${
|
|
171
|
-
color: ${unsafeCSS(inputs.color.foreground.default)};
|
|
172
|
-
background: ${unsafeCSS(inputs.color.background.default)};
|
|
173
|
-
`}
|
|
171
|
+
style=${colorCss(inputs.color)}
|
|
174
172
|
>
|
|
175
173
|
<div class="square"></div>
|
|
176
174
|
<b>Aa</b>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './data/color-class/color-formats.js';
|
|
2
2
|
export * from './data/color-class/color-name-length.js';
|
|
3
3
|
export * from './data/color-class/color.js';
|
|
4
|
+
export * from './data/color-css.js';
|
|
4
5
|
export * from './data/contrast/contrast.js';
|
|
5
6
|
export * from './elements/vir-all-color-space-sliders.element.js';
|
|
6
7
|
export * from './elements/vir-all-spaces-color-picker.element.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './data/color-class/color-formats.js';
|
|
2
2
|
export * from './data/color-class/color-name-length.js';
|
|
3
3
|
export * from './data/color-class/color.js';
|
|
4
|
+
export * from './data/color-css.js';
|
|
4
5
|
export * from './data/contrast/contrast.js';
|
|
5
6
|
export * from './elements/vir-all-color-space-sliders.element.js';
|
|
6
7
|
export * from './elements/vir-all-spaces-color-picker.element.js';
|