Skip to content

Commit

Permalink
GHI-#50 Implement "UI Font Size" theme setting
Browse files Browse the repository at this point in the history
  • Loading branch information
arcticicestudio committed Dec 10, 2016
1 parent 7247bc0 commit fead87d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 = ''
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

0 comments on commit fead87d

Please sign in to comment.