From 0be34cc95a24dc3e3ed53d681bee6bef9bdf017b Mon Sep 17 00:00:00 2001 From: Arctic Ice Studio Date: Sun, 12 May 2019 08:31:23 +0200 Subject: [PATCH 1/2] Deprecate "Custom Comment Contrast" setting with warning notification Removed the logic for the theme setting and added logic to show a deprecation notification when the user has set a value larger than 0. Also removed the Less CSS styles to adapt to the configured value. GH-60 --- index.less | 6 ------ lib/constants.js | 17 ----------------- lib/main.js | 22 ++++++++++++---------- lib/utils.js | 23 ----------------------- styles/syntax-theme-settings.less | 28 ---------------------------- styles/theme-settings-store.less | 1 - 6 files changed, 12 insertions(+), 85 deletions(-) delete mode 100644 lib/constants.js delete mode 100644 lib/utils.js delete mode 100644 styles/syntax-theme-settings.less delete mode 100644 styles/theme-settings-store.less diff --git a/index.less b/index.less index 624c9ed..8579bf8 100644 --- a/index.less +++ b/index.less @@ -46,9 +46,3 @@ @import "styles/languages/shell"; @import "styles/languages/yaml"; @import "styles/languages/xml"; - -/*+----------------+ - + Theme Settings + - +----------------+*/ -@import "styles/syntax-theme-settings"; -@import "styles/theme-settings-store"; diff --git a/lib/constants.js b/lib/constants.js deleted file mode 100644 index 0921e72..0000000 --- a/lib/constants.js +++ /dev/null @@ -1,17 +0,0 @@ -"use babel"; -"use strict"; - -/* - * Copyright (c) 2016-present Arctic Ice Studio - * Copyright (c) 2016-present Sven Greb - * - * Project: Nord Atom Syntax - * Repository: https://github.com/arcticicestudio/nord-atom-syntax - * License: MIT - */ - -module.exports = Object.freeze({ - DEFAULT_COMMENT_CONTRAST: 0, - MINIMUM_COMMENT_CONTRAST: 0, - MAXIMUM_COMMENT_CONTRAST: 20 -}); diff --git a/lib/main.js b/lib/main.js index 31f9ec2..98f56dc 100644 --- a/lib/main.js +++ b/lib/main.js @@ -10,15 +10,18 @@ * License: MIT */ -import fs from "fs"; -import { toggleClass } from "./utils"; - export default { - writeConfig(options) { + handleDeprecatedCustomCommentContrastSetting(options) { let customCommentContrast = atom.config.get("nord-atom-syntax.accessibility.commentContrast"); - let config = `@theme-setting-accessibility-custom-comment-contrast: ${customCommentContrast}%;\n`; + if (customCommentContrast != 0) { + atom.notifications.addWarning(`The "Custom Comment Contrast" theme setting is deprecated and will be removed in version 1.0.0!`, { + detail: "To adapt to the change reset the setting to the default value by deleting the user-defined value from the text field or setting the value to 0.", + description: `The comment color brightness has been increased by 10% by default! + As of version 0.4.0, the setting has no effect anymore. Please see [arcticicestudio/nord-atom-syntax#60](https://github.com/arcticicestudio/nord-atom-syntax/issues/60) for more details.`, + dismissable: true, + icon: "megaphone" + }); - fs.writeFile(`${__dirname}/../styles/theme-settings-store.less`, config, "utf8", () => { if (!options || !options.noReload) { let themePack = atom.packages.getLoadedPackage("nord-atom-syntax"); @@ -28,12 +31,11 @@ export default { } if (options && options.callback && typeof options.callback === "function") { options.callback(); - } - }); + }; + } }, activate() { - toggleClass(true, "theme-nord-atom-syntax-accessibility-custom-comment-contrast"); - atom.config.onDidChange("nord-atom-syntax.accessibility.commentContrast", () =>this.writeConfig({ noReload: true })); + atom.config.onDidChange("nord-atom-syntax.accessibility.commentContrast", () => this.handleDeprecatedCustomCommentContrastSetting({ noReload: true })); } }; diff --git a/lib/utils.js b/lib/utils.js deleted file mode 100644 index a9ba20f..0000000 --- a/lib/utils.js +++ /dev/null @@ -1,23 +0,0 @@ -"use babel"; -"use strict"; - -/* - * Copyright (c) 2016-present Arctic Ice Studio - * Copyright (c) 2016-present Sven Greb - * - * Project: Nord Atom Syntax - * Repository: https://github.com/arcticicestudio/nord-atom-syntax - * License: MIT - */ - -export default { - toggleClass(boolean, className) { - let root = document.querySelector("atom-workspace"); - - if (boolean) { - root.classList.add(className); - } else { - root.classList.remove(className); - } - } -}; diff --git a/styles/syntax-theme-settings.less b/styles/syntax-theme-settings.less deleted file mode 100644 index cac265a..0000000 --- a/styles/syntax-theme-settings.less +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016-present Arctic Ice Studio - * Copyright (c) 2016-present Sven Greb - * - * Project: Nord Atom Syntax - * Repository: https://github.com/arcticicestudio/nord-atom-syntax - * License: MIT - */ - -/*+---------------+ - + Accessibility + - +---------------+*/ -/*+--- Custom Comment Contrast ---+*/ -.theme-@{syntax-theme-name}-accessibility-custom-comment-contrast { - .syntax--comment { - color: lighten(@syntax-color-comment, @theme-setting-accessibility-custom-comment-contrast); - - .syntax--markup.syntax--link { - color: lighten(@syntax-color-comment, @theme-setting-accessibility-custom-comment-contrast); - } - } - - .syntax--punctuation { - &.syntax--comment { - color: lighten(@syntax-color-comment, @theme-setting-accessibility-custom-comment-contrast); - } - } -} diff --git a/styles/theme-settings-store.less b/styles/theme-settings-store.less deleted file mode 100644 index 44840f4..0000000 --- a/styles/theme-settings-store.less +++ /dev/null @@ -1 +0,0 @@ -@theme-setting-accessibility-custom-comment-contrast: 8%; From 09333c315a66b826f8dba54650a3be6d480e88ce Mon Sep 17 00:00:00 2001 From: Arctic Ice Studio Date: Sun, 12 May 2019 08:33:22 +0200 Subject: [PATCH 2/2] Comment Color Brightness -> Please see arcticicestudio/nord#94 for all details about this design change decision. Increased the comment color (`nord3`) brightness by 10% from a lightness level of ~35% to ~45%. This change also deprecates the "Custom Comment Contrast" theme setting. It is not necessary anymore for users to increase the brightness on their own when the default color has been increased by default. A deprecation warning will be shown to notify all users who have set a custom value for the configuration variable. GH-60 --- styles/colors.less | 10 ++++++++++ styles/syntax-variables.less | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 styles/colors.less diff --git a/styles/colors.less b/styles/colors.less new file mode 100644 index 0000000..d8054d3 --- /dev/null +++ b/styles/colors.less @@ -0,0 +1,10 @@ +/* + * Copyright (C) 2016-present Arctic Ice Studio + * Copyright (C) 2016-present Sven Greb + * + * Project: Nord Atom Syntax + * Repository: https://github.com/arcticicestudio/nord-atom-syntax + * License: MIT + */ + +@nord3-brightened: #616E88; diff --git a/styles/syntax-variables.less b/styles/syntax-variables.less index bcb2fd6..18ffcfe 100644 --- a/styles/syntax-variables.less +++ b/styles/syntax-variables.less @@ -11,6 +11,7 @@ + Imports + +---------+*/ @import "nord"; +@import "colors"; /*+------------+ + Animations + @@ -62,7 +63,7 @@ @syntax-color-attribute: @nord7; @syntax-color-attribute-id: @nord7; @syntax-color-class: @nord7; -@syntax-color-comment: @nord3; +@syntax-color-comment: @nord3-brightened; @syntax-color-constant: @nord7; @syntax-color-embedded: @nord9; @syntax-color-escape: @nord12;