This repository has been archived by the owner on Sep 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9bbab52
Showing
7 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
npm-debug.log | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2014 <Your name here> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Atom Theme Switcher | ||
|
||
Switches between one theme and another when you hit a key. Ideal for themes like Solarized that provide both light and dark versions that you may want to switch to under different lighting conditions. | ||
|
||
Mapped to F12 by default. | ||
|
||
See also [outdoor-theme](https://github.com/mattapperson/outdoor-theme), which didn't work for me at time of writing but is theoretically automatic and thus much cooler. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Keybindings require three things to be fully defined: A selector that is | ||
# matched against the focused element, the keystroke and the command to | ||
# execute. | ||
# | ||
# Below is a basic keybinding which registers on all platforms by applying to | ||
# the root workspace element. | ||
|
||
# For more detailed documentation see | ||
# https://atom.io/docs/latest/advanced/keymaps | ||
'.workspace': | ||
'f12': 'theme-switcher:switch' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module.exports = | ||
configDefaults: { | ||
themeOne: 'solarized-dark-syntax' | ||
themeTwo: 'solarized-light-syntax' | ||
} | ||
|
||
activate: (state) -> | ||
atom.workspaceView.command 'theme-switcher:switch', => @switch() | ||
|
||
switch: -> | ||
currentThemes = atom.config.get('core.themes') | ||
currentSyntaxTheme = currentThemes[1] | ||
|
||
themeOne = atom.config.get('theme-switcher.themeOne') | ||
themeTwo = atom.config.get('theme-switcher.themeTwo') | ||
|
||
if currentSyntaxTheme == themeOne | ||
currentThemes[1] = themeTwo | ||
else | ||
currentThemes[1] = themeOne | ||
|
||
atom.config.set('core.themes', currentThemes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "theme-switcher", | ||
"main": "./lib/theme-switcher", | ||
"version": "0.0.0", | ||
"description": "Switches between one theme and another. Ideal for light/dark themes like Solarized.", | ||
"activationEvents": ["theme-switcher:switch"], | ||
"repository": "https://github.com/al3x/atom-theme-switcher", | ||
"license": "MIT", | ||
"engines": { | ||
"atom": ">0.50.0" | ||
}, | ||
"dependencies": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{WorkspaceView} = require 'atom' | ||
|
||
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs. | ||
# | ||
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit` | ||
# or `fdescribe`). Remove the `f` to unfocus the block. | ||
|
||
describe 'ThemeSwitcher', -> | ||
activationPromise = null | ||
|
||
beforeEach -> | ||
atom.workspaceView = new WorkspaceView() | ||
atom.workspaceView.attachToDom() | ||
activationPromise = atom.packages.activatePackage('theme-switcher') | ||
|
||
describe "when the theme-switcher:switch event is triggered", -> | ||
it "switches the theme", -> | ||
defaultThemes = atom.config.get('core.themes') | ||
defaultSyntaxTheme = defaultThemes[1] | ||
|
||
atom.workspaceView.trigger 'theme-switcher:switch' | ||
|
||
waitsForPromise -> | ||
activationPromise | ||
|
||
runs -> | ||
themesAfterTrigger = atom.config.get('core.themes') | ||
syntaxThemeAfterTrigger = themesAfterTrigger[1] | ||
|
||
expect(syntaxThemeAfterTrigger).not.toEqual(defaultSyntaxTheme) | ||
|
||
expect(syntaxThemeAfterTrigger) | ||
.toEqual(atom.config.get('theme-switcher.themeOne')) | ||
|
||
atom.workspaceView.trigger 'theme-switcher:switch' | ||
|
||
expect(atom.config.get('core.themes')[1]) | ||
.toEqual(atom.config.get('theme-switcher.themeTwo')) |