Skip to content

Commit

Permalink
fix: Cleanup color classes for text and background color (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
magnuh committed Jun 20, 2023
1 parent 353d90e commit 1b3d13e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
11 changes: 4 additions & 7 deletions src/_rules/color.js
Expand Up @@ -4,20 +4,17 @@ export const opacity = [

export const caretColors = [
['caret-inherit', { 'caret-color': 'inherit' }],
['caret-current', { 'caret-color': 'currentColor' }],
['caret-transparent', { 'caret-color': 'transparent' }],
['caret-current', { 'caret-color': 'currentColor' }],
];

export const textColors = [
['text', { color: 'var(--w-color-text)' }],
['text-inverted', { color: 'var(--w-color-text-inverted)' }],
['text-inverted-subtle', { color: 'var(--w-color-text-inverted-subtle)' }],
['text-subtle', { color: 'var(--w-color-text-subtle)' }],
// ['text-inherit', { 'color': 'inherit' }], // This class currently sets "text-align: inherit;" in align.js
['text-transparent', { 'color': 'transparent' }],
['text-current', { 'color': 'currentColor' }],
];

export const bgColors = [
['bg', { 'background-color': 'var(--w-color-background)' }],
['bg-subtle', { 'background-color': 'var(--w-color-background-subtle)' }],
['bg-inherit', { 'background-color': 'inherit' }],
['bg-transparent', { 'background-color': 'transparent' }],
['bg-current', { 'background-color': 'currentColor' }],
Expand Down
12 changes: 4 additions & 8 deletions test/__snapshots__/color.js.snap
Expand Up @@ -2,8 +2,6 @@

exports[`bg colors 1`] = `
"/* layer: default */
.bg{background-color:var(--w-color-background);}
.bg-subtle{background-color:var(--w-color-background-subtle);}
.bg-inherit{background-color:inherit;}
.bg-transparent{background-color:transparent;}
.bg-current{background-color:currentColor;}"
Expand All @@ -12,8 +10,8 @@ exports[`bg colors 1`] = `
exports[`caret 1`] = `
"/* layer: default */
.caret-inherit{caret-color:inherit;}
.caret-current{caret-color:currentColor;}
.caret-transparent{caret-color:transparent;}"
.caret-transparent{caret-color:transparent;}
.caret-current{caret-color:currentColor;}"
`;

exports[`opacity by theme 1`] = `
Expand All @@ -27,8 +25,6 @@ exports[`opacity by theme 1`] = `

exports[`text colors 1`] = `
"/* layer: default */
.text{color:var(--w-color-text);}
.text-inverted{color:var(--w-color-text-inverted);}
.text-inverted-subtle{color:var(--w-color-text-inverted-subtle);}
.text-subtle{color:var(--w-color-text-subtle);}"
.text-transparent{color:transparent;}
.text-current{color:currentColor;}"
`;
4 changes: 1 addition & 3 deletions test/color.js
Expand Up @@ -20,7 +20,7 @@ test('opacity not created if invalid', async ({ uno }) => {
});

test('text colors', async({ uno }) => {
const classes = ['text' ,'text-inverted', 'text-inverted-subtle', 'text-subtle'];
const classes = ['text-transparent', 'text-current'];

const { css } = await uno.generate(classes);
expect(css).toMatchSnapshot();
Expand All @@ -35,8 +35,6 @@ test('text color invalid class', async({ uno }) => {

test('bg colors', async({ uno }) => {
const classes = [
'bg',
'bg-subtle',
'bg-inherit',
'bg-transparent',
'bg-current'];
Expand Down

0 comments on commit 1b3d13e

Please sign in to comment.