GithubHelp home page GithubHelp logo

doc22940 / themer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from themerdev/themer

1.0 1.0 0.0 24.01 MB

๐ŸŽจ themer takes a set of colors and generates themes for your apps (editors, terminals, wallpapers, and more).

Home Page: https://themer.dev

License: MIT License

JavaScript 92.03% Swift 0.94% HTML 0.35% CSS 4.85% Shell 1.84%

themer's Introduction

Themer logo

themer CI npm Twitter Follow

themer takes a set of colors and generates editor themes, terminal themes, themes for other apps, and desktop/device wallpapers.

visual description

Table of Contents

Support themer

Installation

Don't love the command-line? Check out the Web UI.

mkdir my-dotfiles && cd my-dotfiles
npm install themer

If you do not keep your dotfiles under version control, you can simply install themer globally with npm -g install themer.

themer can also be used without installing, via npxโ€”see example below.

Usage

Pass themer a color set, as many templates as you wish, and an output directory.

themer \
  --colors <npm package name OR file> \
  --template <npm package name OR file> \
  [--template <npm package name OR file>...] \
  --out <directory>

Your generated theme files, as well as a README on how to install them, will be written to the output directory.

themer can create themes from your custom color sets (see "Create your own color set" below) or from color sets published on npm (see themer-colors-default). The same is true for templates.

Example workflow

Say you wanted to generate a vim theme and desktop background using themer's default color set. First, install themer, the color set, and the templates:

cd my-dotfiles
npm install themer themer-colors-default themer-vim themer-wallpaper-block-wave

Then edit your package.json:

  ...
  "scripts": {
    "build": "themer -c themer-colors-default -t themer-vim -t themer-wallpaper-block-wave -o gen"
  },
  ...

Then run your new script:

npm run build

Now check the gen/ folder for your generated themes. Here's the result:

example usage result

Example usage with npx

npx \
  -p themer \
  -p themer-colors-default \
  -p themer-vim \
  -p themer-wallpaper-block-wave \
  themer \
  -c themer-colors-default \
  -t themer-vim \
  -t themer-wallpaper-block-wave \
  -o output

Themer color sets

Original color sets

Name Dark Preview Light Preview
themer-colors-default themer-colors-default dark preview themer-colors-default light preview
themer-colors-night-sky themer-colors-night-sky dark preview (dark only)
themer-colors-polar-ice themer-colors-polar-ice dark preview themer-colors-polar-ice light preview
themer-colors-finger-paint themer-colors-finger-paint dark preview themer-colors-finger-paint light preview
themer-colors-monkey themer-colors-monkey dark preview themer-colors-monkey light preview
themer-colors-right-in-the-teals themer-colors-right-in-the-teals dark preview themer-colors-right-in-the-teals light preview

Ports from third-party themes

Name Dark Preview Light Preview
themer-colors-one themer-colors-one dark preview themer-colors-one light preview
themer-colors-lucid themer-colors-lucid dark preview themer-colors-lucid light preview
themer-colors-solarized themer-colors-solarized dark preview themer-colors-solarized light preview
themer-colors-github-universe themer-colors-github-universe preview (dark only)
themer-colors-nova themer-colors-nova preview (dark only)
themer-colors-mojave themer-colors-mojave dark preview themer-colors-mojave light preview
themer-colors-rivet themer-colors-rivet dark preview themer-colors-rivet light preview

Create your own color set

To create your own color set, create a JavaScript file that exports a colors object, like so:

module.exports.colors = {

  // A color set can have both light and dark variants, but is only required
  // to have one.
  dark: {

    // Colors can be defined in any valid CSS format.

    // accent0-7 should be the main accent colors of your theme. See the table
    // in the "Color mappings" section for how the colors will be used in your
    // new themes.
    accent0: '#FF4050',
    accent1: '#F28144',
    accent2: '#FFD24A',
    accent3: '#A4CC35',
    accent4: '#26C99E',
    accent5: '#66BFFF',
    accent6: '#CC78FA',
    accent7: '#F553BF',

    // shade0-7 should be shades of the same hue, with shade0 being the
    // background and shade7 being the foreground. If you omit the
    // intermediate shades (1 through 6), they will be calculated automatically
    // for you.
    shade0: '#282629',
    shade1: '#474247',
    shade2: '#656066',
    shade3: '#847E85',
    shade4: '#A29DA3',
    shade5: '#C1BCC2',
    shade6: '#E0DCE0',
    shade7: '#FFFCFF'

  },

  // Same as above, except that shade0 should be the lightest and shade7 should
  // be the darkest.
  light: { ... },

};

Pro Tip: you can use themer's Web UI to more easily select your colors, then click the "Download" button to generate a colors.js file.

Then pass the path to your JS file to the --colors argument of themer.

themer -c path/to/my/colors.js ...

Color mappings

To help you choose colors for your own color set, this is approximately how most themer templates will utilize your colors:

Color Key Typical Usage
accent0 error, VCS deletion
accent1 syntax
accent2 warning, VCS modification
accent3 success, VCS addition
accent4 syntax
accent5 syntax
accent6 syntax, caret/cursor
accent7 syntax, special
shade0 background color
shade1 UI
shade2 UI, text selection
shade3 UI, code comments
shade4 UI
shade5 UI
shade6 foreground text
shade7 foreground text

See themer's Web UI for a more visual representation of the color mappings.

Tips

  • If you omit shade1 through shade6, themer will interpolate them automatically for you, using color-steps.
  • themer supports any valid CSS color format; that means you can use chartreuse, rgb(127, 255, 0), rgb(50%, 100%, 0%), #7FFF00, hsl(90, 100%, 50%), etc.
  • I would recommend checking your color set into your dotfiles repo. Once you've fine-tuned it, you might consider publishing it to npm for others to use! (If you do, consider naming your package starting with themer-colors- so that others can easily find it.)

Using base16 schemes with Themer

In place of a themer color set file or npm package, you can also provide themer with any base16 scheme YAML file.

themer --colors path/to/base16-scheme.yml ...

Refer to the base16 repository for a list of base16 schemes.

Themer templates

Terminals

Editors/IDEs

Wallpapers

Other

Create your own template

To create your own template, create a JavaScript file that exports a render function, like so:

module.exports.render = function(colors, options) {

  // colors is an object that will have one or both keys: 'light' and
  // 'dark', each being an object with keys 'accent0' through 'accent7'
  // and 'shade0' through 'shade7'.

  // options is an object representing the original command-line args
  // passed to themer. This allows you to add special arguments that
  // will apply only to your template. An example of this is allowing a
  // themer user to specify custom resolutions for rendering a wallpaper.

  // This function should return an array of Promises, each Promise
  // resolving to an object of the following structure:
  // {
  //   name: '<the name of the file to be written>', // can include subdirectories, too
  //   contents: <a Buffer of the contents of the file to be written>,
  // }

};

Your JS file can then be passed to a --template argument of themer. That's it!

Here's an example template render function that generates a Slack sidebar theme from a themer color set.

Once you've developed your template, consider publishing it on npm (with repository name starting with themer-) so that others can use it!

About

themer is inspired by trevordmiller/nova and chriskempson/base16.

Conceptually, themer is very similar to base16, but:

  1. It is lighter, and simpler to use.
  2. It is more easily extensible with your own color sets and templates.
  3. It integrates better with your dotfiles, especially if you keep them under version control.

Themer's Web UI

If you'd prefer to develop your themes visually, check out themer's Web UI, an offline-ready Progressive Web App.

themer's People

Contributors

dependabot[bot] avatar divyanshu013 avatar iwestlin avatar mjswensen avatar modille avatar spenserblack avatar therealplato avatar u1f408 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.