Skip to content

chore: update tailwind color names#401

Merged
cguedes merged 1 commit into
mainfrom
400-update-color-variable-names
Aug 23, 2023
Merged

chore: update tailwind color names#401
cguedes merged 1 commit into
mainfrom
400-update-color-variable-names

Conversation

@sehyod

@sehyod sehyod commented Aug 23, 2023

Copy link
Copy Markdown
Collaborator

This creates all tailwind color names, using this json file of exported tokensvariables.json.zip

I wrote small scripts to convert them. I don't think it's worth pushing them but I'll add them here for visibility:

  • for the css variables:
let css = '';
json.collections[0].modes[0].variables.forEach(variable => {
    const r = variable.value.slice(1, 3);
    const g = variable.value.slice(3, 5);
    const b = variable.value.slice(5, 7);
    css += `--${variable.name}: ${parseInt(r, 16)} ${parseInt(g, 16)} ${parseInt(b, 16)};` + '\n';
});
  • for the tailwind names:
const color = {};
tokens.variables.forEach(v => {
    const name = v.name.split('/').pop();
    let hasSuffix = false;
    for (let suffix of ['default', 'active', 'hover', 'disabled', 'primary', 'secondary', 'tertiary', 'inactive']) {
        if (name.endsWith(suffix)) {
            const realName = name.slice(0, -suffix.length-1);
            colors[realName] = { ...(temp[realName] ?? {}), [suffix]: `rgb(var—(${v.value.name}) / <alpha-value>)` };
            hasSuffix = true;
            break;
        }
    }
    if (!hasSuffix) {
        colors[name] = `rgb(var—(${v.value.name}) / <alpha-value>)`;
    }
});

Closes #400

@codecov

codecov Bot commented Aug 23, 2023

Copy link
Copy Markdown

Codecov Report

Merging #401 (216f8a3) into main (1f19ffd) will decrease coverage by 0.03%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##             main     #401      +/-   ##
==========================================
- Coverage   82.94%   82.92%   -0.03%     
==========================================
  Files         180      180              
  Lines       10409    10408       -1     
  Branches     1114     1114              
==========================================
- Hits         8634     8631       -3     
- Misses       1760     1762       +2     
  Partials       15       15              
Files Changed Coverage Δ
src/application/sidebar/LeftSidePanelWrapper.tsx 0.00% <0.00%> (ø)
src/application/sidebar/RightSidePanelWrapper.tsx 0.00% <0.00%> (ø)
src/components/VerticalResizeHandle.tsx 0.00% <0.00%> (ø)
src/splash.tsx 0.00% <0.00%> (ø)
src/application/components/SideBar.tsx 100.00% <100.00%> (ø)
src/application/views/Logo.tsx 100.00% <100.00%> (ø)
src/application/views/WelcomeView.tsx 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@cguedes cguedes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: just left a note about some code (color definitions) we might remove.

Comment thread tailwind.config.js
Comment on lines 18 to 19
muted: 'hsl(var(--color-muted) / <alpha-value>)',
error: 'hsl(var(--color-error) / <alpha-value>)',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should maybe remove these.

@sehyod sehyod Aug 23, 2023

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are still using them for sentence completion suggestions. Let's keep them for now, and we will remove them when we update the autocomplete design

@cguedes cguedes merged commit 51b091f into main Aug 23, 2023
@cguedes cguedes deleted the 400-update-color-variable-names branch August 23, 2023 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update variable names for colors

2 participants