themer采用一组颜色,并生成编辑器主题,终端主题,其他应用程序的主题以及桌面壁纸。
ColorSet STemplate Sthemer 有几种不同的方法可以通过themer来提高您的开发设置:
themer在themer.dev上设有一个官方的渐进式网络应用程序。themer可以用于在CLI上生成主题,请参见下面的CLI文档。themer揭示了用于程序使用的JavaScript API(带有打字稿类型定义);请参阅下面的API文档。功能比较:
| Web UI | CLI/API | |
|---|---|---|
| 即时预览 | ✅ | |
| 优质颜色集 | ✅ | |
| 支持的颜色格式 | 任何CSS格式 | 只有十六进制 |
| 墙纸输出格式 | PNG + SVG | 仅SVG |
| 无缝的互联网集成 | ✅ |
从V5开始, themer将作为单个打字条/JavaScript软件包分布,其中包含所有内置颜色集和模板,以易于使用,但仍然支持使用自定义颜色集或模板的使用。
使用您的JavaScript软件包管理器从NPM安装themer 。
npm install themer themer也可以在全球安装。或者,如果您不想安装它,则可以与npx一起使用。
themer [options]将themer一个或多个颜色集通过您希望的多个模板,随意的壁纸分辨率和输出目录。
| 选项 | 描述 | 默认值 | 可用选项 |
|---|---|---|---|
-c, --color-set <built-in color set name or file path...> | 渲染的颜色集 | default | 颜色集名称或包含自定义颜色集的JS文件的路径或base16 yaml文件的文件路径 |
-t, --template <built-in template name or file path...> | 主题模板渲染 | * (所有内置模板) | 模板名称或包含自定义模板的JS文件的路径 |
-s, --size <wallpaper resolution...> | 分辨率以像素为单位,格式[width] x [高度] | 2880x1800 | 任何 |
-o, --output <path> | 输出目录 | themer-output | 任何 |
--color-set , --template和--size可以多次指定。
您生成的主题文件以及有关如何安装它们的读书文件将写入输出目录。
假设您想使用themer的默认颜色集生成VIM主题和桌面背景。首先,安装themer :
cd my-dotfiles
npm install themer然后编辑您的package.json :
{
"scripts" : {
"build" : " themer -c default -t vim -t vim-lightline -t hyper -t wallpaper-block-wave -o gen "
}
}然后运行您的新脚本:
npm run build现在,检查生成的文件的gen/文件夹。这是结果:
此命令将使用themer的默认颜色集生成VIM主题和Block Wave壁纸,并将它们放入一个称为output的文件夹中:
npx themer -c default -t vim -t wallpaper-block-wave -o output代替主题颜色集,您还可以为themer提供任何Base16方案yaml文件。
themer --color-set path/to/base16-scheme.yml ...
有关基本16方案列表,请参阅base16存储库。
themer器具有JavaScript API(带打字稿类型定义),用于编程生成主题。
npm install themerthemer的默认导出是一个异步生成器函数,该函数采用三个参数:
ColorSet对象或主题内置themer集的字符串标识符Template对象或主题内置themer的字符串标识符RenderOptions对象OutputFileTransform async Generator函数,该函数会转换提供的模板生成的文件。此功能在每个模板的render和renderInstructions功能之间运行。发电机产生的对象是OutputFile s或OutputFileTransform产生的类型。
import themer from "themer" ;
import myColors from "./my-colors" ;
import myTemplate from "./my-template" ;
// Example usage: generate Vim themes, 1440x900 wallpapers, and custom files
// from themer's "Night Sky" color set and a custom color set.
const files = themer (
[ "night-sky" , myColors ] ,
[ "vim" , "wallpaper-block-wave" , myTemplate ] ,
{ wallpaperSizes : [ { width : 1440 , height : 900 } ] }
) ;
for await ( const file of files ) {
// ...
}ColorSet S import type { ColorSet } from "themer" ;
const myColorSet : ColorSet = {
// Color sets should provide a human-readable name.
name : "My Color Set" ,
// Color sets can define a dark variant, a light variant, or both.
// Each variant provides two or eight shades and eight accent colors in hex format.
variants : {
// In a dark variant, shade0 should be the darkest and shade7 should be
// the lightest.
dark : {
shade0 : "#333333" ,
// Note: you can define shades 1 through 6 yourself, or you can omit
// them; if omitted, they will be calculated automatically by
// interpolating between shade0 and shade7.
shade7 : "#eeeeee" ,
accent0 : "#ff4050" ,
accent1 : "#f28144" ,
accent2 : "#ffd24a" ,
accent3 : "#a4cc35" ,
accent4 : "#26c99e" ,
accent5 : "#66bfff" ,
accent6 : "#cc78fa" ,
accent7 : "#f553bf" ,
} ,
// In a light variant, shade7 should be the darkest and shade0 should be
// the lightest.
light : {
shade0 : "#eeeeee" ,
shade7 : "#333333" ,
accent0 : "#f03e4d" ,
accent1 : "#f37735" ,
accent2 : "#eeba21" ,
accent3 : "#97bd2d" ,
accent4 : "#1fc598" ,
accent5 : "#53a6e1" ,
accent6 : "#bf65f0" ,
accent7 : "#ee4eb8" ,
} ,
} ,
} ;
export default myColorSet ;专家提示:您可以使用themer的Web UI更轻松地选择颜色,然后单击“下载”按钮以正确格式生成colors.js 。使用Web UI,您还可以输入任何有效的CSS颜色格式(关键字,HSL,RGB等),并且它将自动为您转换颜色。
为了帮助您选择自己的颜色套装的颜色,这大约是大多数themer模板如何利用您的颜色的方式:
| 颜色键 | 典型用法 | 常规颜色* |
|---|---|---|
accent0 | 错误,VCS删除 | 红色的 |
accent1 | 句法 | 橙子 |
accent2 | 警告,VCS修改 | 黄色的 |
accent3 | 成功,VCS增加 | 绿色的 |
accent4 | 句法 | 青色 |
accent5 | 句法 | 蓝色的 |
accent6 | 语法,商品/光标 | |
accent7 | 语法,特殊 | 品红 |
shade0 | 背景颜色 | |
shade1 | UI | |
shade2 | UI,文本选择 | |
shade3 | UI,代码注释 | |
shade4 | UI | |
shade5 | UI | |
shade6 | 前景文字 | |
shade7 | 前景文字 |
*建议与终端主题中的ANSI颜色名称保持一致,但并不是一个很难的要求。
有关颜色映射的更多视觉表示,请参见themer的Web UI。
Template S import type { Template } from "themer" ;
const template : Template = {
// Templates should provide a human-readable name.
name : "My Template" ,
// The render async generator function takes a color set and the render
// options, and yields one or more output files. The color set is fully
// expanded (e.g., if the color set did not include shades 1 through 6
// when originally authored, those intermediary shades will have already
// been calculated and included).
render : async function * ( colorSet , options ) {
// The yielded output file has two properties: a string path (relative)
// and a Buffer of the file's content.
yield {
path : "my-file.txt" ,
content : Buffer . from ( "Hello, world!" , "utf8" ) ,
} ;
} ,
// The renderInstructions function takes an array of paths generated from
// the render function and should return a Markdown string, which will be
// included in the generated README.md file.
renderInstructions : ( paths ) =>
`Copy the files ( ${ paths . join ( " and " ) } ) to your home directory.` ,
} ;
export default template ; (仅在themer.dev上可用。)
| 姓名 | 黑暗预览 | 光预览 |
|---|---|---|
| jamstacker | (仅黑暗) | |
| 维克多·莫诺(Victor Mono) | ||
| Future Pro |
| 姓名 | 黑暗预览 | 光预览 |
|---|---|---|
default | ||
finger-paint | ||
green-as-a-whistle | ||
monkey | ||
night-sky | (仅黑暗) | |
polar-ice | ||
right-in-the-teals | ||
shoulder-pads |
| 姓名 | 黑暗预览 | 光预览 |
|---|---|---|
dracula | (仅黑暗) | |
github-universe | (仅黑暗) | |
lucid | ||
mojave | ||
nova | (仅黑暗) | |
one | ||
rivet | ||
seti | (仅黑暗) | |
solarized |
alacrittycmdconemuhyperitermkittykonsoleterminalterminatorwarpwindows-terminalbbeditemacssublime-textvim-lightlinevimvisual-studiovs-codexcodealfredbravechromecssfirefox-addonfirefox-colorkde-plasma-colorskeypirinhaprismsketch-palettesslackwoxxresources有关壁纸预览,请参见themer的Web UI。
wallpaper-block-wavewallpaper-burstwallpaper-circuitswallpaper-diamondswallpaper-dot-gridwallpaper-octagonwallpaper-shirtswallpaper-triangleswallpaper-trianglifythemer的灵感来自Trevordmiller/Nova和Chriskempson/Base16。
从概念上讲, themer与base16非常相似,但是:
有关如何为themer做出贡献的说明,请参见贡献。MD和themer的行为准则。
themerthemer