From 96ae183253f806cc2685a46644fdadf25e27e7b5 Mon Sep 17 00:00:00 2001 From: Sven Greb Date: Sat, 10 Dec 2016 13:42:13 +0100 Subject: [PATCH] GHI-#50 Implement "UI Font Size" theme setting --- lib/main.coffee | 14 ++++++++++++++ package.json | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/main.coffee b/lib/main.coffee index e272849..647713e 100644 --- a/lib/main.coffee +++ b/lib/main.coffee @@ -4,12 +4,17 @@ module.exports = activate: (state) -> atom.config.observe 'nord-atom-ui.tabSizing', (noFullWidth) -> setTabSizing(noFullWidth) + atom.config.observe 'nord-atom-ui.darkerFormFocusEffect', (noSnowLight) -> setFormFocusEffect(noSnowLight) + atom.config.observe 'nord-atom-ui.uiFontSize', (uiFontSize) -> + setFontSize(uiFontSize) + deactivate: -> unsetTabSizing() unsetFormFocusEffect() + unsetFontSize() setFormFocusEffect = (noSnowLight) -> if (noSnowLight) @@ -23,8 +28,17 @@ setTabSizing = (noFullWidth) -> else root.setAttribute('theme-nord-atom-ui-tabsizing', "nofullwidth") +setFontSize = (currentFontSize) -> + if Number.isInteger(currentFontSize) + root.style.fontSize = "#{currentFontSize}px" + else if currentFontSize is 'Auto' + unsetFontSize() + unsetFormFocusEffect = -> root.removeAttribute('theme-nord-atom-ui-form-focus-effect') unsetTabSizing = -> root.removeAttribute('theme-nord-atom-ui-tabsizing') + +unsetFontSize = -> + root.style.fontSize = '' diff --git a/package.json b/package.json index 565c7fe..b1afbb1 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,14 @@ "description": "In full width mode, tabs will fill the whole tab bar.", "type": "boolean", "default": true + }, + "uiFontSize": { + "title": "UI Font Size", + "description": "Change the size of the UI font. The minimal size is 8 and the maximal size is 20.", + "type": "integer", + "minimum": 8, + "maximum": 20, + "default": 14 } } }