Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move all colours to CSS variables #3692

Merged
merged 6 commits into from
Jun 29, 2022

Conversation

bonanitech
Copy link
Contributor

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

I know you were not keen on getting this in for 3.0, but I had it done and thought it best to get it PR'd ready for when you are.

I changed all colors (SASS variables) to CSS variables, except for a few hard-coded colors in editor.scss.

I wish I had found a better solution for the colors in .red-ui-tabs-fade. It works, but it's not an elegant solution.

Please review the changes in this PR and let me know if there is anything else to do.

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run grunt to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

@coveralls
Copy link

coveralls commented Jun 18, 2022

Coverage Status

Coverage remained the same at 68.282% when pulling 9b4d3ad on bonanitech:use-css-variables into 95f7ea9 on node-red:master.

@bonanitech bonanitech marked this pull request as ready for review June 28, 2022 11:16
@Steve-Mcl
Copy link
Contributor

@bonanitech I am in the process or reviewing this PR - are there any more changes expected from you?

@bonanitech
Copy link
Contributor Author

No more changes planned to this PR

Only if you find issues during the review 🙂

@Steve-Mcl
Copy link
Contributor

Hi @bonanitech - looks good.


Regarding ...

I wish I had found a better solution for the colors in .red-ui-tabs-fade. It works, but it's not an elegant solution.

I guess you are talking about the linear-gradients where you generated additional alpha vars? to do this with pure CSS you need to do the following...

:root {
    ----red-ui-tab-background-inactive:  240, 240, 240;
}
.class-name {
    background-image: linear-gradient(to right, rgba(var(--red-ui-tab-background-inactive), 0.1), rgba(var(--red-ui-tab-background-inactive), 1));
}

however, since 240, 240, 240 cannot be used as a color var directly (it would have to be wrapped in rgb(var(--red-ui-tab-background-inactive)) so as far as I am concerned, either solution is fine.



Regarding ...

I changed all colors (SASS variables) to CSS variables, except for a few hard-coded colors in editor.scss.

These are what they are and will be corrected at some time regardless of this work (i.e. they are not really of consequence)



Lastly, I have tested a theme (forge-light) and even though it has not been changed to a simple bunch of :root var values, it still works (meaning this change to NR is backwards compatible with existing themes)



@knolleary - i am happy with a first pass and local testing.
And it is sooo nice to be able to simply tweak a CSS var and see what the theme looks like 😄

Copy link
Contributor

@Steve-Mcl Steve-Mcl left a comment

Choose a reason for hiding this comment

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

Functionally, this works.
Some consolidation of variables might be good but that can be iterated.

@bonanitech
Copy link
Contributor Author

Thanks for the feedback @Steve-Mcl

however, since 240, 240, 240 cannot be used as a color var directly (it would have to be wrapped in rgb(var(--red-ui-tab-background-inactive)) so as far as I am concerned, either solution is fine.

I tried this solution too but found it just as ugly as the one I used. Although I think I should make a small change to keep those variables kind of in sync.

$tab-background-active: $secondary-background;
- $tab-background-active-alpha: rgba($secondary-background, 0.001);
+ $tab-background-active-alpha: rgba($tab-background-active, 0.001);
...

@bonanitech
Copy link
Contributor Author

Some consolidation of variables might be good but that can be iterated.

What do you suggest?

@Steve-Mcl
Copy link
Contributor

Some consolidation of variables might be good but that can be iterated.

What do you suggest

For a later time. All good for now.

@knolleary
Copy link
Member

There are a couple merge conflicts to resolve before we can get this in.

@bonanitech
Copy link
Contributor Author

There are a couple merge conflicts to resolve before we can get this in.

Those conflicts are resolved. I also added a small commit to the PR. Please review it again if possible.

Copy link
Contributor

@Steve-Mcl Steve-Mcl left a comment

Choose a reason for hiding this comment

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

Mauricio, I have been running this today. Functionally, it works and I don't see any graphical artefacts. So as far as I'm concerned, it passes.

@knolleary knolleary merged commit c13d2ac into node-red:master Jun 29, 2022
@bonanitech bonanitech deleted the use-css-variables branch June 29, 2022 19:55
bonanitech added a commit to bonanitech/node-red that referenced this pull request Jul 4, 2022
Steve-Mcl added a commit that referenced this pull request Jul 6, 2022
Move colors left behind in #3692 to CSS variables
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.

None yet

4 participants