-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Reduce alpha value of patch background colors #159
Reduce alpha value of patch background colors #159
Conversation
…cks down to 50 to improve contrast with foreground (especially comments), and adjust diff deleted down to 80 as a minor improvement of the same
I've finally got around to having a play with this. I'm perfectly happy to just change the diff_inserted background to I set the alpha for diff_inserted and diff_modified (which also has issues with contrast) down to 50, and just for good measure set the alpha for diff_deleted down to 80. The result seems much more legible to me:
What do you reckon? |
This doesn't seem to work on mac, for some reason. rgba values don't seem to be parsed and the colours default to black. I guess this is known, and possibly why alpha wasn't just tweaked in the first place. |
I was just going to ask how you altered the alpha as I don't have that option on a Mac |
The doc states that 6 digit rgb and 8 digit rgba codes are supported, and the latter work for me on Linux. On Mac it doesn't. I haven't looked any deeper yet. |
Another attempt... Support for RGBA when set in the XML is not consistent, and alpha isn't available via the theme editor in settings, so I've used a picker to pick out the colours with the alpha changes as rgb values and produced the following:
|
Hi @ratskinmahoney 👋, thanks for your contribution 👍 But I'd like to suggest that we should still go with When you compare both of screenshots you might notice that the one that uses
The "transparent" Using Using I know that the comment color doesn't really matches when used with "transparent" Let me know that you think about this change. |
@arcticicestudio - I've no complaint with that. I should find time tomorrow to make the change. Cheers! |
@arcticicestudio - a day late, but here it is... I've used nord9 for insertion. Based on 33 alpha this comes out as This is the result for the diff I was using previously: And here's what it looks like in the settings preview: The only potential issue is that the colour used for conflict is based on nord10, which is obviously quite close to nord9 (see lines 4&5 on the left of the settings preview, vs line 7). I personally don't have a problem with this. I can tell the difference when I see both together, and context is clear anyway. I actually like it like this. If you think this will be a problem though, let me know. Now that I've been looking at it a while. I definitely agree that nord9 is a better choice than nord14 |
Please don't stress yourself, after all this is open source not paid work with deadlines 😄 The overall design looks much better in my opinion now, but I'd like to suggest some small adjustments to the colors to make them more precise. You said you've used a color picker to get the actual HEX values, but this can be different based on your monitor, color profile and OS settings. Unfortunately colors are quite more complex when you dive deeper into the topic, e.g. the following methods of the screenshot will produce different colors when picked in the IDE. To solve this we can calculate the colors to get exact and predictable colors, at least for usage in other ports if required as well as in languages like CSS. @use "sass:color";
$nord0: #2e3440;
$nord9: #81a1c1;
$nord11: #bf616a;
$nord13: #ebcb8b;
@function rgba-to-rgb($rgba, $background: $nord0) {
@return mix(
rgb(red($rgba), green($rgba), blue($rgba)),
$background,
alpha($rgba) * 100%
);
}
:root {
--diff-added-reduced-alpha: #{rgba-to-rgb(color.scale($nord9, $alpha: -80%))};
--diff-deleted-reduced-alpha: #{rgba-to-rgb(color.scale($nord11, $alpha: -80%))};
--diff-modified-reduced-alpha: #{rgba-to-rgb(color.scale($nord13, $alpha: -80%))};
} Compiling this Sass code using the official Dart reference implementation via the CLI results in the following colors: :root {
--diff-added-reduced-alpha: #3f4a5a;
--diff-deleted-reduced-alpha: #4b3d48;
--diff-modified-reduced-alpha: #54524f;
} As you can see the color for deleted lines already matched perfectly with your color, but for added and modified lines the values a slightly different. Even though the changes are minimal, this should be changed to make this change consistent with other themes. |
@arcticicestudio - That is not something I would have considered, though it makes perfect sense. Colours have been corrected as suggested. I used the converter to check the value for nord10 (for conflict) as well, and the value currently in the commit was correct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, let's get this merged :D
Thanks again for this PR, this will make many users happier.
@arcticicestudio - great! Thanks very much for your help. It's a pleasure to contribute. |
The colors have been calculated using the Sass `scale` function [1] that allows to "fluidly scale one or more properties of a color" like e.g. alpha or saturation. Also see nordtheme/jetbrains#159 [2] for more details. ```scss @use "sass:color"; $nord0: #2e3440; $foreground: #d8dee9; $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: -30%)); } @function rgba-to-rgb($rgba, $background: $nord0) { @return mix( rgb(red($rgba), green($rgba), blue($rgba)), $background, alpha($rgba) * 100% ); } :root { --foreground: #{dim($foreground)}; --black: #{dim($black)}; --red: #{dim($red)}; --green: #{dim($green)}; --yellow: #{dim($yellow)}; --blue: #{dim($blue)}; --magenta: #{dim($magenta)}; --cyan: #{dim($cyan)}; --white: #{dim($white)}; } ``` [1]: https://sass-lang.com/documentation/modules/color#scale [2]: nordtheme/jetbrains#159 (comment) Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com> Closes GH-12
Adjusted the background colors for patches by reducing their alpha value by 80%. The resulting RGBA color was converted precisely into the respective RGB color (HEX format) since JetBrains rendering engine still has problems when using the 8-digit HEX format that includes the value for the alpha layer. The values have been calculated to get exact and predictable colors, at least for usage in other ports if required as well as in languages like CSS. Sass [1] comes with the color module that provides the scale function [2] that allows to "fluidly scale one or more properties of a color" like e.g. alpha or saturation: ```scss @use "sass:color"; $nord0: #2e3440; $nord9: #81a1c1; $nord11: #bf616a; $nord13: #ebcb8b; @function rgba-to-rgb($rgba, $background: $nord0) { @return mix( rgb(red($rgba), green($rgba), blue($rgba)), $background, alpha($rgba) * 100% ); } :root { --diff-added-reduced-alpha: #{rgba-to-rgb(color.scale($nord9, $alpha: -80%))}; --diff-deleted-reduced-alpha: #{rgba-to-rgb(color.scale($nord11, $alpha: -80%))}; --diff-modified-reduced-alpha: #{rgba-to-rgb(color.scale($nord13, $alpha: -80%))}; } ``` Compiling the Sass code above using the official Dart reference implementation [3] via the CLI resulted in the following colors: ```css :root { --diff-added-reduced-alpha: #3f4a5a; --diff-deleted-reduced-alpha: #4b3d48; --diff-modified-reduced-alpha: #54524f; } ``` [1]: https://sass-lang.com [2]: https://sass-lang.com/documentation/modules/color#scale [3]: https://github.com/sass/dart-sass GH-159 Co-authored-by: Arctic Ice Studio <development@arcticicestudio.com> Co-authored-by: Sven Greb <development@svengreb.de>
Adjust the alpha of the background for diff inserted and modified blocks down to 50 to improve contrast with foreground (especially comments), and adjust diff deleted down to 80 as a minor improvement of the same.
Addresses issue: #103