2013-08-27 22:54:14 +04:00
|
|
|
# Creating a Theme
|
|
|
|
|
2013-10-31 01:37:13 +04:00
|
|
|
Atom's interface is rendered using HTML, and it's styled via [LESS] (a superset
|
2014-02-22 04:06:09 +04:00
|
|
|
of CSS). Don't worry if you haven't heard of LESS before; it's just like CSS,
|
|
|
|
but with a few handy extensions.
|
2013-10-14 23:30:08 +04:00
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
Atom supports two types of themes _UI_ and _syntax_. UI themes style
|
|
|
|
elements such as the tree view, the tabs, drop-down lists, and the status bar.
|
|
|
|
Syntax themes style the code inside the editor.
|
2013-10-14 23:30:08 +04:00
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
Themes can be installed and changed from the settings view which you can open
|
|
|
|
by selecting the _Atom > Preferences..._ menu and navigating to the _Themes_
|
|
|
|
section on the left hand side.
|
2013-08-27 22:54:14 +04:00
|
|
|
|
|
|
|
## Getting Started
|
|
|
|
|
2013-10-14 23:30:08 +04:00
|
|
|
Themes are pretty straight forward but it's still helpful to be familiar with
|
|
|
|
a few things before starting:
|
|
|
|
|
2013-10-31 01:37:13 +04:00
|
|
|
* LESS is a superset of CSS, but it has some really handy features like
|
2013-10-16 02:20:33 +04:00
|
|
|
variables. If you aren't familiar with its syntax take a few minutes
|
2013-10-14 23:30:08 +04:00
|
|
|
to [familiarize yourself][less-tutorial].
|
2013-10-31 01:37:13 +04:00
|
|
|
* You may also want to review the concept of a _[package.json]_, too. This file
|
2014-02-22 04:06:09 +04:00
|
|
|
is used to help distribute your theme to Atom users.
|
2014-02-22 21:58:07 +04:00
|
|
|
* Your theme's _package.json_ must contain a `"theme"` key with a value
|
|
|
|
of `"ui"` or `"syntax"` for Atom to recognize and load it as a theme.
|
2014-02-22 04:06:09 +04:00
|
|
|
* You can find existing themes to install or fork on [atom.io](atomio).
|
2013-10-31 01:37:13 +04:00
|
|
|
|
|
|
|
## Creating a Syntax Theme
|
|
|
|
|
|
|
|
Let's create your first theme.
|
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
To get started, hit `cmd-shift-P`, and start typing "Generate Syntax Theme" to
|
|
|
|
generate a new theme package. Select "Generate Syntax Theme," and you'll be
|
2014-02-22 21:58:42 +04:00
|
|
|
asked for the path where your theme will be created. Let's call ours _motif_.
|
2013-10-31 01:37:13 +04:00
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
Atom will pop open a new window, showing the _motif_ theme, with a default set
|
|
|
|
of folders and files created for us. If you open the settings view (`cmd-,`)
|
|
|
|
and navigate to the _Themes_ section on the left, you'll see the _Motif_ theme
|
|
|
|
listed in the _Syntax Theme_ drop-down. Select it from the menu to activate it,
|
|
|
|
now when you open an editor you should see that your new _motif_ theme in
|
|
|
|
action.
|
2013-10-31 01:37:13 +04:00
|
|
|
|
|
|
|
Open up _stylesheets/colors.less_ to change the various colors variables which
|
|
|
|
have been already been defined. For example, turn `@red` into `#f4c2c1`.
|
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
Then open _stylesheets/base.less_ and modify the various selectors that have
|
2014-02-22 22:00:14 +04:00
|
|
|
been already been defined. These selectors style different parts of code in the
|
|
|
|
editor such as comments, strings and the line numbers in the gutter.
|
2013-10-31 01:37:13 +04:00
|
|
|
|
|
|
|
As an example, let's make the `.gutter` `background-color` into `@red`.
|
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
Reload Atom by pressing `cmd-alt-option-L` to see the changes you made reflected
|
|
|
|
in your Atom window. Pretty neat!
|
2013-10-31 01:37:13 +04:00
|
|
|
|
|
|
|
## Creating an Interface Theme
|
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
Interface themes **must** provide a `ui-variables.less` file which contains all
|
2013-10-31 01:37:13 +04:00
|
|
|
of the variables provided by the [core themes][ui-variables].
|
|
|
|
|
|
|
|
To create an interface UI theme, do the following:
|
2013-10-17 04:18:32 +04:00
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
1. Fork one of the following repositories:
|
|
|
|
* [atom-dark-ui]
|
|
|
|
* [atom-light-ui]
|
|
|
|
2. Cloned your forked themed repository to the local filesystem
|
|
|
|
2. Open a terminal in the forked theme's directory
|
|
|
|
3. Open your new theme in a Dev Mode Atom window run `atom --dev .` in the
|
|
|
|
terminal or use the _View > Developer > Open in Dev Mode_ menu)
|
|
|
|
4. Change the name of the theme in the theme's `package.json` file
|
|
|
|
5. Run `apm link` to symlink your repository to `~/.atom/packages`
|
|
|
|
6. Reload Atom using `cmd-alt-ctrl-L`
|
|
|
|
7. Enable the theme via _UI Theme_ drop-down in the _Themes_ section of the
|
|
|
|
settings view
|
|
|
|
8. Make changes! Since you opened the theme in a Dev Mode window, changes will
|
2013-10-17 04:18:32 +04:00
|
|
|
be instantly reflected in the editor without having to reload.
|
|
|
|
|
2013-10-17 02:11:20 +04:00
|
|
|
## Development workflow
|
2013-10-14 23:30:08 +04:00
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
There are a few of tools to help make theme development faster and easier
|
2013-10-17 02:11:20 +04:00
|
|
|
|
|
|
|
### Live Reload
|
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
Reloading by hitting `cmd-alt-ctrl-L` after you make changes to your theme is
|
|
|
|
less than ideal. Atom supports [live updating][livereload] of styles on Dev Mode
|
|
|
|
Atom windows.
|
2013-10-17 02:11:20 +04:00
|
|
|
|
2013-10-31 01:37:13 +04:00
|
|
|
To enable a Dev Mode window:
|
|
|
|
|
|
|
|
1. Open your theme directory in a dev window by either going to the
|
2014-02-22 04:06:09 +04:00
|
|
|
__View > Developer > Open in Dev Mode__ menu or by hitting the `cmd-shift-o`
|
|
|
|
shortcut
|
|
|
|
2. Make a change to your theme file and save it. Your change should be
|
|
|
|
immediately applied!
|
2013-10-17 02:11:20 +04:00
|
|
|
|
2013-10-31 01:37:13 +04:00
|
|
|
If you'd like to reload all the styles at any time, you can use the shortcut
|
2014-02-22 04:06:09 +04:00
|
|
|
`cmd-ctrl-shift-r`.
|
2013-10-17 02:11:20 +04:00
|
|
|
|
|
|
|
### Developer Tools
|
|
|
|
|
|
|
|
Atom is based on the Chrome browser, and supports Chrome's Developer Tools. You
|
2014-02-22 04:06:09 +04:00
|
|
|
can open them by selecting the _View > Toggle Developer Tools_ menu, or by
|
|
|
|
using the `cmd-alt-i` shortcut.
|
2013-10-17 02:11:20 +04:00
|
|
|
|
|
|
|
The dev tools allow you to inspect elements and take a look at their CSS
|
|
|
|
properties.
|
|
|
|
|
|
|
|
![devtools-img]
|
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
Check out Google's [extensive tutorial][devtools-tutorial] for a short
|
|
|
|
introduction.
|
2013-10-31 01:37:13 +04:00
|
|
|
|
2013-10-17 02:11:20 +04:00
|
|
|
### Atom Styleguide
|
|
|
|
|
|
|
|
If you are creating an interface theme, you'll want a way to see how your theme
|
|
|
|
changes affect all the components in the system. The [styleguide] is a page with
|
|
|
|
every component Atom supports rendered.
|
|
|
|
|
2013-12-04 23:33:04 +04:00
|
|
|
To open the styleguide, open the command palette (`cmd-shift-P`) and search for
|
2013-10-31 01:37:13 +04:00
|
|
|
_styleguide_, or use the shortcut `cmd-ctrl-shift-g`.
|
2013-10-17 02:11:20 +04:00
|
|
|
|
|
|
|
![styleguide-img]
|
2013-10-14 23:30:08 +04:00
|
|
|
|
2014-02-22 04:06:09 +04:00
|
|
|
[atomio]: http://atom.io/packages
|
2013-10-15 04:00:16 +04:00
|
|
|
[less]: http://lesscss.org/
|
2013-10-14 23:30:08 +04:00
|
|
|
[git]: http://git-scm.com/
|
2013-10-15 04:00:16 +04:00
|
|
|
[atom]: https://atom.io/
|
2013-10-31 01:37:13 +04:00
|
|
|
[package.json]: ./creating-a-package.html#package-json
|
2013-10-14 23:30:08 +04:00
|
|
|
[less-tutorial]: https://speakerdeck.com/danmatthews/less-css
|
|
|
|
[devtools-tutorial]: https://developers.google.com/chrome-developer-tools/docs/elements
|
2013-10-31 01:37:13 +04:00
|
|
|
[ui-variables]: ./theme-variables.html
|
2013-10-17 02:11:20 +04:00
|
|
|
[livereload]: https://github.com/atom/dev-live-reload
|
|
|
|
[styleguide]: https://github.com/atom/styleguide
|
2013-10-17 04:18:32 +04:00
|
|
|
[atom-dark-ui]: https://github.com/atom/atom-dark-ui
|
|
|
|
[atom-light-ui]: https://github.com/atom/atom-light-ui
|
2013-10-17 02:11:20 +04:00
|
|
|
[styleguide-img]: https://f.cloud.github.com/assets/69169/1347390/2d431d98-36af-11e3-8f8e-3f4ce1e67adb.png
|
|
|
|
[devtools-img]: https://f.cloud.github.com/assets/69169/1347391/2d51f91c-36af-11e3-806f-f7b334af43e9.png
|
2013-10-17 04:05:26 +04:00
|
|
|
[themesettings-img]: https://f.cloud.github.com/assets/69169/1347569/3150bd0c-36b2-11e3-9d69-423503acfe3f.png
|