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

Add Dim Colors #12

Merged
merged 2 commits into from
Aug 25, 2020
Merged

Add Dim Colors #12

merged 2 commits into from
Aug 25, 2020

Conversation

amayer5125
Copy link
Contributor

No description provided.

@amayer5125
Copy link
Contributor Author

@arcticicestudio we probably need to calculate these values. I'm not sure how dim to make them or exactly to calculate them. I'm guessing we could use sass like you pointed out in nordtheme/jetbrains#159 (comment), but I'm not familiar enough with complex sass to understand what is going on there. If you want the values dimmed by 20% or something I could write a python script to calculate them for me. I just need to know how much to dim them by. Not sure if the theme has a standard for things like this.

@amayer5125
Copy link
Contributor Author

I read through the sass stuff again and I got it figured out. I ran it with -80% alpha like in your example. Let me know if I should change this number.

Here is the code I came up with to dim all the colors:

@use "sass:color";

$nord0: #2e3440;
$black: #3b4252;
$red: #bf616a;
$green: #a3be8c;
$yellow: #ebcb8b;
$blue: #81a1c1;
$magenta: #b48ead;
$cyan: #88c0d0;
$white: #e5e9f0;

@function dim($color) {
  @return rgba-to-rgb(color.scale($color, $alpha: -80%));
}

@function rgba-to-rgb($rgba, $background: $nord0) {
  @return mix(
    rgb(red($rgba), green($rgba), blue($rgba)),
    $background,
    alpha($rgba) * 100%
  );
}

:root {
  black: #{dim($black)};
  red: #{dim($red)};
  green: #{dim($green)};
  yellow: #{dim($yellow)};
  blue: #{dim($blue)};
  magenta: #{dim($magenta)};
  cyan: #{dim($cyan)};
  white: #{dim($white)};
}

@amayer5125
Copy link
Contributor Author

@arcticicestudio I'm not sure what you want me to do here. I've already updated the code using the output of my last comment. Is there something you would like changed?

@arcticicestudio
Copy link
Contributor

Sorry, either I forgot to send my comment or somehow GitHub lost it 😕

We should use a decreased opacity of 30% instead of 80% because the change in nordtheme/jetbrains#159 was targeted to the background color that marks Git changes. Therefore the transparency of the color(s) have been reduced with a high value of 80% to ensure that the foreground color(s) are still readable.
In case of this issue we're targeting the foreground color and the dimmed colors should still be recognizable when e.g. the terminal is not focused and the colors are dimmed.

Dim by 30%
@amayer5125
Copy link
Contributor Author

Updated with 30% dim. Same script as above but -30% instead of -80%.

svengreb
svengreb previously approved these changes Aug 25, 2020
Copy link
Contributor

@arcticicestudio arcticicestudio left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM 🚀

@arcticicestudio arcticicestudio dismissed stale reviews from svengreb and themself via f13db38 August 25, 2020 06:23
Copy link
Contributor

@arcticicestudio arcticicestudio left a comment

Choose a reason for hiding this comment

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

I've also forgot to mention that we should add dim_foreground too to ensure that text that uses the default color is dimmed too. I've quickly calculated and added the value based on the current foreground color.

@arcticicestudio arcticicestudio merged commit 940c88a into nordtheme:develop Aug 25, 2020
@arcticicestudio
Copy link
Contributor

Release Note Assets

Normal

Dimmed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants