├── assets
├── screenshot-owl.png
├── screenshot-rubber.png
├── screenshot-summer.png
└── screenshot-mariana.png
├── colors
├── lw-owl.lua
├── lw-kyoto.lua
├── lw-summer.lua
├── lw-mariana.lua
└── lw-rubber.lua
├── demo
├── yaml.yml
├── json.json
├── ruby.rb
├── markdown.md
├── html.html
├── react.js
├── css.css
├── vue.vue
├── javascript.js
├── php.php
└── typescript.ts
├── LICENSE
├── lua
└── little-wonder
│ ├── themes
│ ├── rubber.lua
│ ├── summer.lua
│ ├── mariana.lua
│ ├── owl.lua
│ └── kyoto.lua
│ └── init.lua
└── README.md
/assets/screenshot-owl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VonHeikemen/little-wonder/HEAD/assets/screenshot-owl.png
--------------------------------------------------------------------------------
/assets/screenshot-rubber.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VonHeikemen/little-wonder/HEAD/assets/screenshot-rubber.png
--------------------------------------------------------------------------------
/assets/screenshot-summer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VonHeikemen/little-wonder/HEAD/assets/screenshot-summer.png
--------------------------------------------------------------------------------
/assets/screenshot-mariana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VonHeikemen/little-wonder/HEAD/assets/screenshot-mariana.png
--------------------------------------------------------------------------------
/colors/lw-owl.lua:
--------------------------------------------------------------------------------
1 | local theme = require('little-wonder.themes.owl')
2 |
3 | require('little-wonder').apply('lw-owl', theme.get())
4 |
--------------------------------------------------------------------------------
/colors/lw-kyoto.lua:
--------------------------------------------------------------------------------
1 | local theme = require('little-wonder.themes.kyoto')
2 |
3 | require('little-wonder').apply('lw-kyoto', theme.get())
4 |
5 |
--------------------------------------------------------------------------------
/colors/lw-summer.lua:
--------------------------------------------------------------------------------
1 | local theme = require('little-wonder.themes.summer')
2 |
3 | require('little-wonder').apply('lw-summer', theme.get())
4 |
5 |
--------------------------------------------------------------------------------
/colors/lw-mariana.lua:
--------------------------------------------------------------------------------
1 | local theme = require('little-wonder.themes.mariana')
2 |
3 | require('little-wonder').apply('lw-mariana', theme.get())
4 |
5 |
--------------------------------------------------------------------------------
/demo/yaml.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "6"
4 | install:
5 | - npm install
6 | script:
7 | - npm test
8 | after_script:
9 | - npm run coveralls
10 | notifications:
11 | email:
12 | on_success: never
13 | on_failure: always
14 |
--------------------------------------------------------------------------------
/colors/lw-rubber.lua:
--------------------------------------------------------------------------------
1 | local lw = require('little-wonder')
2 | local theme = require('little-wonder.themes.rubber')
3 |
4 | lw.apply('lw-rubber', theme.get())
5 |
6 | ---
7 | -- Custom rules
8 | ---
9 |
10 | lw.link('TelescopeMatching', 'WarningMsg')
11 |
12 |
--------------------------------------------------------------------------------
/demo/json.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "es6": true,
4 | "mocha": true,
5 | "node": true
6 | },
7 | "extends": "eslint:recommended",
8 | "rules": {
9 | "indent": ["error", 2],
10 | "linebreak-style": ["error", "unix"],
11 | "quotes": ["error", "single"],
12 | "semi": ["error", "always"]
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/demo/ruby.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Users
4 | def current_user
5 | @current_user ||= User.find(1)
6 | end
7 | end
8 |
9 | class Api::V1::UsersController < ApplicationController
10 | include Users
11 |
12 | PER_PAGE = 10
13 |
14 | QUERY = <<-SQL
15 | SELECT * FROM users;
16 | SQL
17 |
18 | def index
19 | {
20 | foo: 1
21 | bar: 'abc'
22 | }
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/demo/markdown.md:
--------------------------------------------------------------------------------
1 | # Night Owl Theme
2 |
3 | > Night Owl theme for VS Code.
4 |
5 | 
6 |
7 | # Installation
8 |
9 | 1. Install [Visual Studio Code](https://code.visualstudio.com/)
10 | 2. Launch Visual Studio Code
11 | 3. Choose **Extensions** from menu
12 | 4. Search for `vscode-theme-cobalt2`
13 | 5. Click **Install** to install it
14 | 6. Click **Reload** to reload the Code
15 | 7. File > Preferences > Color Theme > **Cobalt2**
16 |
--------------------------------------------------------------------------------
/demo/html.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 | Tacos Tacos
13 |
14 | Tacos tacos tacos
15 |
16 |
17 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/demo/react.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import calculate from '../logic/calculate'
3 | import './App.css'
4 | import ButtonPanel from './ButtonPanel'
5 | import Display from './Display'
6 |
7 | class App extends React.Component {
8 | constructor(props) {
9 | super(props)
10 | this.state = {
11 | total: null,
12 | next: null,
13 | operation: null
14 | }
15 | }
16 |
17 | handleClick = buttonName => {
18 | this.setState(calculate(this.state, buttonName))
19 | }
20 |
21 | render() {
22 | return (
23 |
24 | Tacos
25 |
26 |
27 |
28 | )
29 | }
30 | }
31 | export default App
--------------------------------------------------------------------------------
/demo/css.css:
--------------------------------------------------------------------------------
1 | .someClass {
2 | font-family: "Helvetica Neue", Roboto, sans-serif;
3 | box-shadow: rgba(0, 0, 0, 0.25) 0 1px 0, inset rgba(255, 255, 255, 0.16) 0 1px 0;
4 | }
5 |
6 | #someID {
7 | background: yellow;
8 | }
9 |
10 | main {
11 | margin-top: 20px;
12 | background: url(http://localhost/8bcLQqF.png)
13 | }
14 |
15 | .navbar-nav > li > a, .navbar-brand {
16 | color: #fff !important;
17 | }
18 |
19 | form input[type="text"] {
20 | display: -ms-flexbox;
21 | display: flex;
22 | }
23 |
24 | /* Comments */
25 | @media (max-width: 1270px) and (min-width: 192px) {
26 | .someClass:hover {
27 | position: static !important;
28 | }
29 |
30 | .someClass::after {
31 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
32 | -moz-border-radius: 2px;
33 | -webkit-border-radius: 2px;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/demo/vue.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
32 |
33 |
45 |
--------------------------------------------------------------------------------
/demo/javascript.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | import {Base} from './path';
3 |
4 | class Sale extends Base.Other {
5 | constructor(price) {
6 | super();
7 | ;[this.decoratorsList, this.price] = [[], price]
8 | }
9 |
10 | decorate(decorator) {
11 | if (!Sale[decorator]) throw new Error(`decorator not exist: ${decorator}`)
12 | this.decoratorsList.push(Sale[decorator])
13 | }
14 |
15 | static quebec(price) {
16 | // this is a comment
17 | return price + price * 7.5 / 100
18 | }
19 | }
20 |
21 |
22 | var test = () => {
23 |
24 | };
25 |
26 | new Promise();
27 | require('test');
28 |
29 | let sale = new Sale(100)
30 | sale.decorate('fedtax')
31 | sale.decorate('quebec')
32 | console.log(sale.getPrice()) //112.88
33 |
34 | getPrice()
35 |
36 | //deeply nested
37 |
38 | async function asyncCall() {
39 | var result = await resolveAfter2Seconds();
40 | }
41 |
42 | for (let i=0; i <10; i++) {
43 | continue;
44 | }
45 |
46 | if (true) {}
47 |
48 | while (true) {}
49 |
50 | switch(2) {
51 | case 2:
52 | break;
53 | default:
54 | break;
55 | }
56 |
57 | try {
58 |
59 | } catch(e) {
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Heiker Curiel
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/demo/php.php:
--------------------------------------------------------------------------------
1 | pdo = new PDO(
12 | $GLOBALS['db_dsn'],
13 | $GLOBALS['db_username'],
14 | $GLOBALS['db_password']
15 | );
16 | $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
17 | $this->pdo->query("CREATE TABLE hello (what VARCHAR(50) NOT NULL)");
18 | }
19 | public function tearDown()
20 | {
21 | $this->pdo->query("DROP TABLE hello");
22 | }
23 | public function testHelloWorld()
24 | {
25 | $helloWorld = new HelloWorld($this->pdo);
26 | $this->assertEquals('Hello World', $helloWorld->hello());
27 | }
28 | public function testHello()
29 | {
30 | $helloWorld = new HelloWorld($this->pdo);
31 | $this->assertEquals('Hello Bar', $helloWorld->hello('Bar'));
32 | }
33 | public function testWhat()
34 | {
35 | $helloWorld = new HelloWorld($this->pdo);
36 | $this->assertFalse($helloWorld->what());
37 | $helloWorld->hello('Bar');
38 | $this->assertEquals('Bar', $helloWorld->what());
39 | }
40 | }
41 | ?>
42 |
43 |
--------------------------------------------------------------------------------
/demo/typescript.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, OnDestroy } from '@angular/core'
2 | import { Person, SearchService } from '../shared'
3 | import { ActivatedRoute } from '@angular/router'
4 | import { Subscription } from 'rxjs'
5 |
6 | @Component({
7 | selector: 'app-search',
8 | templateUrl: './search.component.html',
9 | styleUrls: ['./search.component.css']
10 | })
11 | export class SearchComponent implements OnInit, OnDestroy {
12 | query: string
13 | searchResults: Array
14 | sub: Subscription
15 |
16 | constructor(
17 | private searchService: SearchService,
18 | private route: ActivatedRoute
19 | ) {}
20 |
21 | ngOnInit() {
22 | this.sub = this.route.params.subscribe(params => {
23 | if (params['term']) {
24 | this.query = decodeURIComponent(params['term'])
25 | this.search()
26 | }
27 | })
28 | }
29 |
30 | search(): void {
31 | this.searchService.search(this.query).subscribe(
32 | (data: any) => {
33 | this.searchResults = data
34 | },
35 | error => console.log(error)
36 | )
37 | }
38 |
39 | ngOnDestroy() {
40 | if (this.sub) {
41 | this.sub.unsubscribe()
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/lua/little-wonder/themes/rubber.lua:
--------------------------------------------------------------------------------
1 | local color = {
2 | white = {gui = '#ABB2BF', cterm = 249},
3 | black = {gui = '#21252B', cterm = 234},
4 | green = {gui = '#98C379', cterm = 108},
5 | blue = {gui = '#61AFEF', cterm = 75 },
6 | cyan = {gui = '#56B6C2', cterm = 73 },
7 | red = {gui = '#E06C75', cterm = 168},
8 | magenta = {gui = '#BF79C3', cterm = 139},
9 | yellow = {gui = '#D19A66', cterm = 173},
10 |
11 | dark_gray = {gui = '#737C8C', cterm = 8 },
12 | wild_red = {gui = '#DF334A', cterm = 167},
13 | dark_blue = {gui = '#3B4049', cterm = 236},
14 | bright_white = {gui = '#D4D7D9', cterm = 188},
15 | bright_black = {gui = '#5F6672', cterm = 239},
16 | darkness = {gui = '#2F3542', cterm = 235},
17 | black_metal = {gui = '#2C3036', cterm = 236},
18 | light_gray = {gui = '#56595E', cterm = 240}
19 | }
20 |
21 | local theme = function()
22 | return {
23 | globals = {
24 | type = 'dark',
25 | foreground = color.white,
26 | background = color.black,
27 | },
28 | syntax = {
29 | comment = color.red,
30 | string = color.green,
31 | constant = color.magenta,
32 | storage = color.blue,
33 | special = color.dark_gray,
34 | error = color.wild_red,
35 | error_bg = nil
36 | },
37 | ui = {
38 | cursorline = color.dark_blue,
39 | selection = color.dark_blue,
40 | colorcolumn = color.bright_black,
41 | dark_text = color.dark_gray,
42 | line_nr = color.dark_gray,
43 | line_bg = color.darkness,
44 | folds = color.dark_gray,
45 | menu_item = color.black_metal,
46 | menu_selected = color.light_gray,
47 | search = color.yellow,
48 | matchparen = color.yellow,
49 | info = color.cyan,
50 | warning = color.yellow,
51 | error = color.red
52 | },
53 | terminal = {
54 | white = color.white.gui,
55 | bright_white = color.bright_white.gui,
56 | black = color.black.gui,
57 | bright_black = color.bright_black.gui,
58 | red = color.red.gui,
59 | green = color.green.gui,
60 | blue = color.blue.gui,
61 | magenta = color.magenta.gui,
62 | yellow = color.yellow.gui,
63 | cyan = color.cyan.gui,
64 | },
65 | }
66 | end
67 |
68 |
69 | local update = function(override)
70 | return vim.tbl_deep_extend(
71 | 'force',
72 | theme(),
73 | override or {}
74 | )
75 | end
76 |
77 | return {
78 | get = theme,
79 | update = update,
80 | palette = function() return color end
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/lua/little-wonder/themes/summer.lua:
--------------------------------------------------------------------------------
1 | local color = {
2 | white = {gui = '#FBFBFB', cterm = 15 },
3 | black = {gui = '#403F53', cterm = 238},
4 | green = {gui = '#4E7240', cterm = 239},
5 | blue = {gui = '#4876D6', cterm = 68 },
6 | cyan = {gui = '#0C969B', cterm = 30 },
7 | red = {gui = '#BC5454', cterm = 131},
8 | magenta = {gui = '#994CC3', cterm = 97 },
9 | yellow = {gui = '#C96765', cterm = 167},
10 |
11 | gray = {gui = '#989FB1', cterm = 247},
12 | light_cyan = {gui = '#93A1A1', cterm = 247},
13 | smoke_white = {gui = '#F0F0F0', cterm = 254},
14 | gainsboro_white = {gui = '#E0E0E0', cterm = 254},
15 | darkness = {gui = '#CECECE', cterm = 252},
16 | dim_gray = {gui = '#CBCBCB', cterm = 251},
17 | whiteee = {gui = '#EEEEEE', cterm = 254},
18 | bright_black = {gui = '#5F6672', cterm = 242},
19 | pink = {gui = '#FF2C83', cterm = 198},
20 | }
21 |
22 | local theme = function()
23 | return {
24 | globals = {
25 | type = 'light',
26 | foreground = color.black,
27 | background = color.white,
28 | },
29 | syntax = {
30 | comment = color.green,
31 | string = color.yellow,
32 | constant = color.red,
33 | storage = color.blue,
34 | special = color.light_cyan,
35 | error = color.pink,
36 | error_bg = nil
37 | },
38 | ui = {
39 | cursorline = color.smoke_white,
40 | selection = color.gainsboro_white,
41 | colorcolumn = color.smoke_white,
42 | dark_text = color.gray,
43 | line_nr = color.gray,
44 | line_bg = color.darkness,
45 | folds = color.bright_black,
46 | menu_item = color.whiteee,
47 | menu_selected = color.dim_gray,
48 | search = color.light_cyan,
49 | matchparen = color.magenta,
50 | info = color.cyan,
51 | warning = color.yellow,
52 | error = color.red
53 | },
54 | terminal = {
55 | white = color.white.gui,
56 | bright_white = color.whiteee.gui,
57 | black = color.black.gui,
58 | red = color.red.gui,
59 | green = color.green.gui,
60 | blue = color.blue.gui,
61 | magenta = color.magenta.gui,
62 | yellow = color.yellow.gui,
63 | cyan = color.cyan.gui,
64 | },
65 | }
66 | end
67 |
68 | local update = function(override)
69 | return vim.tbl_deep_extend(
70 | 'force',
71 | theme(),
72 | override or {}
73 | )
74 | end
75 |
76 | return {
77 | get = theme,
78 | update = update,
79 | palette = function() return color end
80 | }
81 |
82 |
--------------------------------------------------------------------------------
/lua/little-wonder/themes/mariana.lua:
--------------------------------------------------------------------------------
1 | local color = {
2 | white = {gui = '#D8DEE9', cterm = 253},
3 | black = {gui = '#343D46', cterm = 237},
4 | green = {gui = '#99C794', cterm = 114},
5 | blue = {gui = '#6699CC', cterm = 111},
6 | cyan = {gui = '#5FB4B4', cterm = 73 },
7 | red = {gui = '#EC5F66', cterm = 203},
8 | magenta = {gui = '#C695C6', cterm = 176},
9 | yellow = {gui = '#FFCB6B', cterm = 221},
10 |
11 | orange = {gui = '#F9AE58', cterm = 215},
12 | gray = {gui = '#A6ACB9', cterm = 145},
13 | bright_gray = {gui = '#46505B', cterm = 239},
14 | space_gray = {gui = '#3D4752', cterm = 239},
15 | dark_gray = {gui = '#2F353C', cterm = 235},
16 | light_gray = {gui = '#939393', cterm = 238},
17 | dark_blue = {gui = '#4E5A65', cterm = 240},
18 | charcoil = {gui = '#3D4751', cterm = 239},
19 | dim_gray = {gui = '#62686F', cterm = 242},
20 | silver = {gui = '#B0AEB0', cterm = 145},
21 | bright_yellow = {gui = '#F2CA27', cterm = 220},
22 | }
23 |
24 | local theme = function()
25 | return {
26 | globals = {
27 | type = 'dark',
28 | foreground = color.white,
29 | background = color.black,
30 | },
31 | syntax = {
32 | comment = color.gray,
33 | string = color.green,
34 | constant = color.orange,
35 | storage = color.blue,
36 | special = color.cyan,
37 | error = color.red,
38 | error_bg = nil
39 | },
40 | ui = {
41 | cursorline = color.space_gray,
42 | selection = color.bright_gray,
43 | colorcolumn = color.dark_blue,
44 | dark_text = color.silver,
45 | line_nr = color.light_gray,
46 | line_bg = color.charcoil,
47 | folds = color.dim_gray,
48 | menu_item = color.dark_gray,
49 | menu_selected = color.dim_gray,
50 | search = color.bright_yellow,
51 | matchparen = color.yellow,
52 | info = color.cyan,
53 | warning = color.yellow,
54 | error = color.red
55 | },
56 | terminal = {
57 | white = color.white.gui,
58 | black = color.black.gui,
59 | red = color.red.gui,
60 | green = color.green.gui,
61 | blue = color.blue.gui,
62 | magenta = color.magenta.gui,
63 | yellow = color.orange.gui,
64 | cyan = color.cyan.gui,
65 | },
66 | }
67 | end
68 |
69 | local update = function(override)
70 | return vim.tbl_deep_extend(
71 | 'force',
72 | theme(),
73 | override or {}
74 | )
75 | end
76 |
77 | return {
78 | get = theme,
79 | update = update,
80 | palette = function() return color end
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/lua/little-wonder/themes/owl.lua:
--------------------------------------------------------------------------------
1 | local color = {
2 | white = {gui = '#D6DEEB', cterm = 253},
3 | black = {gui = '#011627', cterm = 238},
4 | green = {gui = '#98C379', cterm = 108},
5 | blue = {gui = '#82AAFF', cterm = 111},
6 | cyan = {gui = '#56B6C2', cterm = 73 },
7 | red = {gui = '#FF869A', cterm = 210},
8 | magenta = {gui = '#C792EA', cterm = 139},
9 | yellow = {gui = '#ECC48D', cterm = 222},
10 |
11 | bright_black = {gui = '#5F6672', cterm = 242},
12 | bright_white = {gui = '#D4D7D9', cterm = 188},
13 | pink = {gui = '#FF2C83', cterm = 198},
14 | pale_yellow = {gui = '#FFEB95', cterm = 222},
15 |
16 | gray = {gui = '#8893A6', cterm = 103},
17 | dark_blue = {gui = '#01121F', cterm = 237},
18 | sad_blue = {gui = '#1D3B53', cterm = 237},
19 | pale_blue = {gui = '#0E2232', cterm = 235},
20 | live_blue = {gui = '#3E4E5B', cterm = 239},
21 | darkness = {gui = '#17223C', cterm = 234},
22 | }
23 |
24 | local theme = function()
25 | return {
26 | globals = {
27 | type = 'dark',
28 | foreground = color.white,
29 | background = color.black,
30 | },
31 | syntax = {
32 | comment = color.red,
33 | string = color.pale_yellow,
34 | constant = color.magenta,
35 | storage = color.blue,
36 | special = color.gray,
37 | error = color.pink,
38 | error_bg = nil
39 | },
40 | ui = {
41 | cursorline = color.dark_blue,
42 | selection = color.sad_blue,
43 | colorcolumn = color.dark_blue,
44 | dark_text = color.gray,
45 | line_nr = color.gray,
46 | line_bg = color.darkness,
47 | folds = color.bright_black,
48 | menu_item = color.pale_blue,
49 | menu_selected = color.live_blue,
50 | search = color.magenta,
51 | matchparen = color.yellow,
52 | info = color.cyan,
53 | warning = color.yellow,
54 | error = color.red
55 | },
56 | terminal = {
57 | white = color.white.gui,
58 | bright_white = color.bright_white.gui,
59 | black = color.black.gui,
60 | bright_black = color.bright_black.gui,
61 | red = color.red.gui,
62 | green = color.green.gui,
63 | blue = color.blue.gui,
64 | magenta = color.magenta.gui,
65 | yellow = color.pale_yellow.gui,
66 | cyan = color.cyan.gui,
67 | },
68 | }
69 | end
70 |
71 | local update = function(override)
72 | return vim.tbl_deep_extend(
73 | 'force',
74 | theme(),
75 | override or {}
76 | )
77 | end
78 |
79 | return {
80 | get = theme,
81 | update = update,
82 | palette = function() return color end
83 | }
84 |
85 |
--------------------------------------------------------------------------------
/lua/little-wonder/themes/kyoto.lua:
--------------------------------------------------------------------------------
1 | local color = {
2 | white = {gui = '#C0CAF5', cterm = 153},
3 | black = {gui = '#24283B', cterm = 235},
4 | green = {gui = '#9ECE6A', cterm = 149},
5 | blue = {gui = '#7AA2F7', cterm = 111},
6 | cyan = {gui = '#73DACA', cterm = 80 },
7 | red = {gui = '#F7768E', cterm = 210},
8 | magenta = {gui = '#BB9AF7', cterm = 141},
9 | yellow = {gui = '#E0AF68', cterm = 179},
10 |
11 | bright_black = {gui = '#1F2335', cterm = 234},
12 | bright_white = {gui = '#DADFE1', cterm = 253},
13 | bright_blue = {gui = '#3D59A1', cterm = 62 },
14 | blue_two = {gui = '#3B4261', cterm = 239},
15 | blue_three = {gui = '#364A82', cterm = 239},
16 | gray_two = {gui = '#222229', cterm = 235},
17 |
18 | gray = {gui = '#565F89', cterm = 60},
19 | light_gray = {gui = '#292E42', cterm = 236},
20 | dark_gray = {gui = '#6B7678', cterm = 243},
21 | }
22 |
23 | local theme = function()
24 | return {
25 | globals = {
26 | type = 'dark',
27 | foreground = color.white,
28 | background = color.black,
29 | },
30 | syntax = {
31 | comment = color.gray,
32 | string = color.green,
33 | constant = color.yellow,
34 | storage = color.blue,
35 | special = color.dark_gray,
36 | error = color.red,
37 | error_bg = nil
38 | },
39 | ui = {
40 | cursorline = color.light_gray,
41 | selection = color.blue_three,
42 | colorcolumn = color.bright_black,
43 | dark_text = color.dark_gray,
44 | line_nr = color.dark_gray,
45 | line_bg = color.bright_black,
46 | folds = color.dark_gray,
47 | menu_item = color.bright_black,
48 | menu_selected = color.light_gray,
49 | search = color.yellow,
50 | matchparen = color.yellow,
51 | info = color.cyan,
52 | warning = color.yellow,
53 | error = color.red
54 | },
55 | terminal = {
56 | white = color.white.gui,
57 | black = color.black.gui,
58 | red = color.red.gui,
59 | green = color.green.gui,
60 | blue = color.blue.gui,
61 | magenta = color.magenta.gui,
62 | yellow = color.yellow.gui,
63 | cyan = color.cyan.gui,
64 | },
65 | groups = {
66 | PmenuThumb = {bg = color.blue_two},
67 | PmenuSbar = {bg = color.gray_two},
68 | Search = {bg = color.bright_blue},
69 | }
70 | }
71 | end
72 |
73 | local update = function(override)
74 | return vim.tbl_deep_extend(
75 | 'force',
76 | theme(),
77 | override or {}
78 | )
79 | end
80 |
81 | return {
82 | get = theme,
83 | update = update,
84 | palette = function() return color end
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Little Wonder
2 |
3 | A collection of extensible color schemes with minimal amount of highlighting for Neovim.
4 |
5 | Inspired by the same premise of the [alabaster color scheme](https://github.com/tonsky/sublime-scheme-alabaster) for Sublime Text it defines just four classes:
6 |
7 | - Strings
8 | - Known constants (numbers, symbols, booleans)
9 | - Comments
10 | - Functions
11 |
12 | ## Getting Started
13 |
14 | Make sure you have [Neovim v0.7.0](https://github.com/neovim/neovim/releases/tag/v0.7.0) or greater.
15 |
16 | ### Installation
17 |
18 | Use your favorite plugin manager. For example.
19 |
20 | With `mini.deps`:
21 |
22 | ```lua
23 | MiniDeps.add('VonHeikemen/little-wonder')
24 | ```
25 |
26 | With `vim-plug`:
27 |
28 | ```vim
29 | Plug 'VonHeikemen/little-wonder'
30 | ```
31 |
32 | ## Themes
33 |
34 | - `lw-rubber`
35 |
36 | 
37 |
38 | - `lw-mariana`
39 |
40 | 
41 |
42 | - `lw-owl`
43 |
44 | 
45 |
46 | - `lw-summer`
47 |
48 | 
49 |
50 | ## Create your own theme
51 |
52 | > Documentation on this subject is a work in progress.
53 |
54 | Did you know colorschemes can be lua files? Yes, they can. You can make use of the helper functions on this plugin to create your very own colorscheme.
55 |
56 | The first step to create a colorscheme is to create a `colors` folder right next to your `init` file. Next, inside that new folder, create a lua file with the name of your colorscheme.
57 |
58 | ### By extending an available theme
59 |
60 | Each [theme](https://github.com/VonHeikemen/little-wonder/tree/main/lua/themes) has an `.update` function that allows you to override the default values. What are the defaults? Well, they are divided in four categories.
61 |
62 | * globals
63 | * syntax
64 | * ui
65 | * terminal
66 |
67 | Each "category" is a table that can take a "highlight". And, a "highlight" is a table that contains the properties `gui` and `cterm`. `gui` is a string with an hexadecimal code that represents a color. `cterm` must be a number within the range of 0 and 255, these represent colors (some) terminals support (here is a [cheatsheet](https://www.ditig.com/256-colors-cheat-sheet) with previews of colors for `cterm`).
68 |
69 | If you want to get familiar with all the properties in each category I recommend reading the source code of one theme.
70 |
71 | Anyway, here is an example that show how can you make a theme based on `lw-rubber`. For this example we'll create a theme called `darkling`. Make a `colors/darkling.lua`.
72 |
73 | ```lua
74 | local lw = require('little-wonder')
75 | local rubber = require('little-wonder.themes.rubber')
76 |
77 | local theme = rubber.update({
78 | globals = {
79 | background = lw.NONE --> use the background of terminal
80 | },
81 | syntax = {
82 | string = {gui = '#FFEB95', cterm = 222},
83 | storage = {gui = '#89C4F4', cterm = 75 }
84 | }
85 | })
86 |
87 | lw.apply('darkling', theme)
88 |
89 | ---
90 | -- Custom rules
91 | ---
92 |
93 | -- make telescope matches yellow
94 | lw.highlight('TelescopeMatching', {gui = '#FFEB95'})
95 |
96 | -- make matching pair the same color as booleans (why not?)
97 | lw.link('MatchParen', 'Boolean')
98 | ```
99 |
100 | Notice here that I also showed `.highlight` and `.link`, they don't do much. Those two are just tiny wrappers around `vim.api.nvim_set_hl`, you can use that function directly if you want to.
101 |
102 | Now in you `init.lua` make sure you can use it only when `little-wonder` is installed.
103 |
104 | ```lua
105 | local ok, lw = pcall(require, 'little-wonder')
106 |
107 | if ok then vim.cmd('colorscheme darkling') end
108 | ```
109 |
110 | If you use an `init.vim`.
111 |
112 | ```vim
113 | try
114 | colorscheme darkling
115 | catch
116 | " do something else
117 | endtry
118 | ```
119 |
120 | ### Create from scratch
121 |
122 | You don't have to base your new colorscheme from an existing one. You can do it "from scratch".
123 |
124 | ```lua
125 | local lw = require('little-wonder')
126 |
127 | local color = {
128 | white = {gui = '#DCE0DD', cterm = 249},
129 | black = {gui = '#2F343F', cterm = 234},
130 | green = {gui = '#87D37C', cterm = 108},
131 | blue = {gui = '#89C4F4', cterm = 75 },
132 | cyan = {gui = '#50C6D8', cterm = 73 },
133 | red = {gui = '#FC8680', cterm = 168},
134 | magenta = {gui = '#DDA0DD', cterm = 139},
135 | yellow = {gui = '#F2CA27', cterm = 173},
136 |
137 | bright_black = {gui = '#5F6672', cterm = 242},
138 | bright_white = {gui = '#DADFE1', cterm = 253},
139 |
140 | dark_gray = {gui = '#939393', cterm = 246},
141 | gray = {gui = '#8893A6', cterm = 103},
142 | light_gray = {gui = '#404750', cterm = 238},
143 | wild_red = {gui = '#DF334A', cterm = 167},
144 | dark_blue = {gui = '#242830', cterm = 235},
145 | darkness = {gui = '#3B4252', cterm = 238},
146 | }
147 |
148 | local theme = {
149 | globals = {
150 | type = 'dark',
151 | foreground = color.white,
152 | background = color.black,
153 | },
154 | syntax = {
155 | comment = color.red,
156 | string = color.green,
157 | constant = color.magenta,
158 | storage = color.blue,
159 | special = color.dark_gray,
160 | error = color.wild_red,
161 | error_bg = nil
162 | },
163 | ui = {
164 | cursorline = color.dark_blue,
165 | selection = color.light_gray,
166 | colorcolumn = color.bright_black,
167 | dark_text = color.dark_gray,
168 | line_nr = color.dark_gray,
169 | line_bg = color.darkness,
170 | folds = color.dark_gray,
171 | menu_item = color.dark_blue,
172 | menu_selected = color.bright_black,
173 | search = color.yellow,
174 | matchparen = color.yellow,
175 | info = color.cyan,
176 | warning = color.yellow,
177 | error = color.red
178 | },
179 | terminal = {
180 | white = color.white.gui,
181 | bright_white = color.bright_white.gui,
182 | black = color.black.gui,
183 | bright_black = color.bright_black.gui,
184 | red = color.red.gui,
185 | green = color.green.gui,
186 | blue = color.blue.gui,
187 | magenta = color.magenta.gui,
188 | yellow = color.yellow.gui,
189 | cyan = color.cyan.gui,
190 | }
191 | }
192 |
193 | lw.apply('darkling', theme)
194 |
195 | ---
196 | -- Custom rules
197 | --
198 |
199 | -- do whatever you want...
200 | ```
201 |
202 | That's it. A "theme" is actually just a lua table.
203 |
204 | ## Support
205 |
206 | If you find this project useful and want to support my efforts, you can donate in [ko-fi.com/vonheikemen](https://ko-fi.com/vonheikemen).
207 |
208 | [](https://ko-fi.com/vonheikemen)
209 |
210 |
--------------------------------------------------------------------------------
/lua/little-wonder/init.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 | local H = {}
3 |
4 | local FG = {}
5 | local BG = {}
6 | local none = {gui = 'NONE', cterm = 'NONE'}
7 | local ts_legacy = vim.fn.has('nvim-0.9') == 0
8 |
9 | M.no_color = 'LittleWonderNone'
10 | M.normal = 'LittleWonderNormal'
11 |
12 | local hs = function(group, colors, style)
13 | local opts = {
14 | fg = colors.fg.gui,
15 | bg = colors.bg.gui,
16 | ctermfg = colors.fg.cterm,
17 | ctermbg = colors.bg.cterm,
18 | }
19 |
20 | for _, item in ipairs(style) do
21 | opts[item] = true
22 | end
23 |
24 | vim.api.nvim_set_hl(0, group, opts)
25 | end
26 |
27 | local hi = function(group, colors)
28 | vim.api.nvim_set_hl(0, group, {
29 | fg = colors.fg.gui,
30 | bg = colors.bg.gui,
31 | ctermfg = colors.fg.cterm,
32 | ctermbg = colors.bg.cterm,
33 | })
34 | end
35 |
36 | local link = function(group, link)
37 | vim.api.nvim_set_hl(0, group, {link = link})
38 | end
39 |
40 | local clear = function(group)
41 | vim.api.nvim_set_hl(0, group, {})
42 | end
43 |
44 | function H.set_normal(theme)
45 | FG.gui = theme.foreground.gui or 'NONE'
46 | BG.gui = theme.background.gui or 'NONE'
47 | FG.cterm = theme.foreground.cterm or 'NONE'
48 | BG.cterm = theme.background.cterm or 'NONE'
49 |
50 | hi('Normal', {fg = FG, bg = BG})
51 | hi(M.normal, {fg = FG, bg = none})
52 | hi(M.no_color, {fg = none, bg = none})
53 | end
54 |
55 | function H.base_syntax(theme)
56 | local ebg = theme.error_bg or none
57 |
58 | hi('Comment', {fg = theme.comment, bg = none})
59 | hi('String', {fg = theme.string, bg = none})
60 | hi('Character', {fg = theme.constant, bg = none})
61 | hi('Number', {fg = theme.constant, bg = none})
62 | hi('Boolean', {fg = theme.constant, bg = none})
63 | hi('Float', {fg = theme.constant, bg = none})
64 | hi('Function', {fg = theme.storage, bg = none})
65 | hi('Special', {fg = theme.special, bg = none})
66 | hi('SpecialChar', {fg = theme.special, bg = none})
67 | hi('SpecialKey', {fg = theme.special, bg = none})
68 | hi('Error', {fg = theme.error, bg = ebg })
69 |
70 | clear('Constant')
71 | clear('Statement')
72 | clear('Conditional')
73 | clear('Exception')
74 | clear('Identifier')
75 | clear('Type')
76 | clear('Repeat')
77 | clear('Label')
78 | clear('Operator')
79 | clear('Keyword')
80 | clear('Delimiter')
81 | clear('Tag')
82 | clear('SpecialComment')
83 | clear('Debug')
84 | clear('PreProc')
85 | clear('Include')
86 | clear('Define')
87 | clear('Macro')
88 | clear('PreCondit')
89 | clear('StorageClass')
90 | clear('Structure')
91 | clear('Typedef')
92 | clear('Title')
93 | clear('Todo')
94 | end
95 |
96 | function H.ui(theme)
97 | local underline = {'underline'}
98 | local syntax = theme.syntax
99 | local ui = theme.ui
100 |
101 | hi('Cursor', {fg = BG, bg = FG })
102 | hi('CursorLine', {fg = none, bg = ui.cursorline })
103 | hi('CursorLineNr', {fg = none, bg = BG })
104 | hi('ColorColumn', {fg = none, bg = ui.colorcolumn })
105 | hi('LineNr', {fg = ui.line_nr, bg = none })
106 | hi('NonText', {fg = ui.line_nr, bg = BG })
107 | hi('EndOfBuffer', {fg = ui.dark_text, bg = BG })
108 | hi('VertSplit', {fg = ui.line_bg, bg = BG })
109 | hi('Folded', {fg = ui.folds, bg = BG })
110 | hi('FoldColumn', {fg = ui.folds, bg = BG })
111 | hi('SignColumn', {fg = none, bg = BG })
112 | hi('PMenu', {fg = none, bg = ui.menu_item })
113 | hi('PMenuSel', {fg = none, bg = ui.menu_selected})
114 | hi('TabLine', {fg = none, bg = ui.line_bg })
115 | hi('TabLineFill', {fg = none, bg = ui.line_bg })
116 | hi('TabLineSel', {fg = none, bg = BG })
117 | hi('StatusLine', {fg = none, bg = ui.line_bg })
118 | hi('StatusLineNC', {fg = ui.dark_text, bg = ui.line_bg })
119 | hi('WildMenu', {fg = BG, bg = ui.search })
120 | hi('Visual', {fg = none, bg = ui.selection })
121 | hi('Search', {fg = BG, bg = ui.search })
122 | hi('IncSearch', {fg = BG, bg = ui.search })
123 |
124 | hs('MatchParen', {fg = ui.matchparen, bg = none}, underline)
125 |
126 | hi('ErrorMsg', {fg = ui.error, bg = none})
127 | hi('WarningMsg', {fg = ui.warning, bg = none})
128 |
129 | hi('DiagnosticError', {fg = ui.error, bg = none})
130 | hi('DiagnosticWarn', {fg = ui.warning, bg = none})
131 | hi('DiagnosticInfo', {fg = ui.info, bg = none})
132 | hi('DiagnosticHint', {fg = FG, bg = none})
133 |
134 | hs('DiagnosticUnderlineError', {fg = ui.error, bg = none}, underline)
135 | hs('DiagnosticUnderlineWarn', {fg = ui.warning, bg = none}, underline)
136 | hs('DiagnosticUnderlineInfo', {fg = ui.info, bg = none}, underline)
137 | hs('DiagnosticUnderlineHint', {fg = FG, bg = none}, underline)
138 |
139 | hi('NotifyWARNIcon', {fg = ui.warning, bg = none})
140 | hi('NotifyWARNBorder', {fg = ui.warning, bg = none})
141 | hi('NotifyWARNTitle', {fg = ui.warning, bg = none})
142 | hi('NotifyERRORIcon', {fg = ui.error, bg = none})
143 | hi('NotifyERRORBorder', {fg = ui.error, bg = none})
144 | hi('NotifyERRORTitle', {fg = ui.error, bg = none})
145 |
146 | hi('MiniStatuslineModeNormal', {fg = BG, bg = syntax.storage })
147 | hi('MiniStatuslineModeVisual', {fg = BG, bg = syntax.constant})
148 | hi('MiniStatuslineModeInsert', {fg = BG, bg = syntax.string })
149 | hi('MiniStatuslineModeCommand', {fg = BG, bg = syntax.special })
150 | hi('MiniStatuslineModeOther', {fg = BG, bg = syntax.comment })
151 | end
152 |
153 | function H.apply_links()
154 | -- UI: Misc
155 | link('Conceal', 'Visual')
156 |
157 | -- UI: Diff
158 | link('DiffAdd', 'DiagnosticWarn')
159 | link('DiffChange', 'DiagnosticInfo')
160 | link('DiffDelete', 'DiagnosticError')
161 | link('DiffText', 'Visual')
162 |
163 | -- UI: search
164 | link('CurSearch', 'IncSearch')
165 |
166 | -- UI: window
167 | link('FloatBorder', 'Normal')
168 |
169 | -- UI: messages
170 | link('Question', 'String')
171 |
172 | -- UI: Diagnostic
173 | link('DiagnosticSignError', 'DiagnosticError')
174 | link('DiagnosticSignWarn', 'DiagnosticWarn')
175 | link('DiagnosticSignInfo', 'DiagnosticInfo')
176 | link('DiagnosticSignHint', 'DiagnosticHint')
177 | link('DiagnosticFloatingError', 'DiagnosticError')
178 | link('DiagnosticFloatingWarn', 'DiagnosticWarn')
179 | link('DiagnosticFloatingInfo', 'DiagnosticInfo')
180 | link('DiagnosticFloatingHint', 'DiagnosticHint')
181 | link('DiagnosticVirtualTextError', 'DiagnosticError')
182 | link('DiagnosticVirtualTextWarn', 'DiagnosticWarn')
183 | link('DiagnosticVirtualTextInfo', 'DiagnosticInfo')
184 | link('DiagnosticVirtualTextHint', 'DiagnosticHint')
185 |
186 | -- UI: Netrw
187 | link('Directory', 'Function')
188 | link('netrwDir', 'Function')
189 | link('netrwHelpCmd', 'Special')
190 | link('netrwMarkFile', 'Search')
191 |
192 | -- Plugin: NERDTree
193 | link('NERDTreeDir', 'Function')
194 | link('NERDTreeDirSlash', 'Function')
195 | link('NERDTreeUp', 'Function')
196 | link('NERDTreeOpenable', 'Function')
197 | link('NERDTreeClosable', 'Function')
198 | link('NERDTreeToggleOn', 'Boolean')
199 | link('NERDTreeToggleOff', 'Boolean')
200 | link('NERDTreeHelp', 'Comment')
201 |
202 | -- Plugin: lir.nvim
203 | link('LirDir', 'Function')
204 |
205 | -- Plugin: snacks.nvim
206 | clear('SnacksPickerDir')
207 | link('SnacksPickerListCursorLine', 'CursorLine')
208 |
209 | -- Plugin: mini.snippets
210 | clear('MiniSnippetsCurrent')
211 | link('MiniSnippetsCurrentReplace', 'Visual')
212 | clear('MiniSnippetsFinal')
213 | clear('MiniSnippetsUnvisited')
214 | clear('MiniSnippetsVisited')
215 |
216 | -- Language: lua
217 | -- Syntax: built-in
218 | clear('luaFunction')
219 |
220 | -- Language: HTML
221 | -- Syntax: built-in
222 | link('htmlTag', 'Special')
223 | link('htmlEndTag', 'Special')
224 | link('htmlTagName', 'Function')
225 | link('htmlSpecialTagName', 'Function')
226 | clear('htmlArg')
227 |
228 |
229 | -- Language: CSS
230 | -- Syntax: built-in
231 | link('cssTagName', 'Function')
232 | link('cssColor', 'Number')
233 | clear('cssVendor')
234 | clear('cssBraces')
235 | clear('cssSelectorOp')
236 | clear('cssSelectorOp2')
237 | clear('cssIdentifier')
238 | clear('cssClassName')
239 | clear('cssClassNameDot')
240 | clear('cssVendor')
241 | clear('cssImportant')
242 | clear('cssAttributeSelector')
243 |
244 |
245 | -- Language: PHP
246 | -- Syntax: built-in
247 | link('phpNullValue', 'Boolean')
248 | link('phpSpecialFunction', 'Function')
249 | clear('phpParent')
250 | clear('phpClasses')
251 |
252 |
253 | -- Language: Javascript
254 | -- Syntax: built-in
255 | link('javaScriptNumber', 'Number')
256 | link('javaScriptNull', 'Number')
257 | clear('javaScriptBraces')
258 | clear('javaScriptFunction')
259 |
260 |
261 | -- Language: Javascript
262 | -- Syntax: 'pangloss/vim-javascript'
263 | link('jsFunctionKey', 'Function')
264 | link('jsUndefined', 'Number')
265 | link('jsNull', 'Number')
266 | clear('jsSuper')
267 | clear('jsThis')
268 | clear('jsArguments')
269 |
270 |
271 | -- Language: Typescript
272 | -- Syntax: built-in
273 | clear('typescriptImport')
274 | clear('typescriptExport')
275 | clear('typescriptBraces')
276 | clear('typescriptDecorator')
277 | clear('typescriptParens')
278 | clear('typescriptCastKeyword')
279 |
280 |
281 | -- Language: JSX
282 | -- Syntax: 'maxmellon/vim-jsx-pretty'
283 | link('jsxTagName', 'Function')
284 | link('jsxComponentName', 'Function')
285 | link('jsxPunct', 'Special')
286 | link('jsxCloseString', 'Special')
287 | link('jsxEqual', 'Special')
288 | clear('jsxAttrib')
289 |
290 |
291 | -- Language: Twig
292 | -- Syntax: 'lumiliet/vim-twig'
293 | link('twigString', 'String')
294 | clear('twigOperator')
295 |
296 |
297 | -- Language: Ruby
298 | -- Syntax: 'vim-ruby/vim-ruby'
299 | link('rubyClassName', 'Function')
300 | link('rubyModuleName', 'Function')
301 | link('rubySymbol', 'Number')
302 | link('rubyMagicComment', 'Comment')
303 | link('rubyHeredocDelimiter', 'Special')
304 |
305 |
306 | -- Language: V
307 | -- Syntax: 'ollykel/v-vim'
308 | link('vFunctionCall', 'Function')
309 | link('vBuiltins', 'Function')
310 | clear('vStringVar')
311 | clear('vType')
312 |
313 |
314 | -- Language: Nelua
315 | -- Syntax: 'stefanos82/nelua.vim'
316 | link('neluaFunc', 'Function')
317 | clear('neluaFunction')
318 |
319 |
320 | -- Python
321 | link('pythonDecorator', 'Special')
322 | clear('pythonDecoratorName')
323 | clear('pythonBuiltin')
324 |
325 | -- Treesitter
326 | if ts_legacy then
327 | link('TSConstBuiltin', 'Number')
328 | link('TSFuncBuiltin', 'Function')
329 | clear('TSConstructor')
330 | clear('TSVariableBuiltin')
331 | clear('luaTSPunctBracket')
332 | clear('TSKeywordFunction')
333 | else
334 | link('@function.call', 'Function')
335 | link('@function.builtin', 'Function')
336 | link('@constant.builtin', 'Number')
337 | link('@type.css', 'Function')
338 | link('@constructor.php', 'Function')
339 | link('@tag.delimiter', 'Special')
340 | link('@tag', 'Function')
341 | link('@text.uri.html', 'String')
342 |
343 | clear('@variable')
344 | clear('@punctuation.bracket')
345 | clear('@constructor')
346 | clear('@method.vue')
347 | clear('@tag.attribute')
348 | clear('@text.literal')
349 | clear('@text.literal.vimdoc')
350 | clear('@text.literal.vimdoc')
351 | clear('@variable.builtin.php')
352 | clear('@tag.delimiter.twig')
353 | clear('@punctuation.bracket.twig')
354 | clear('@string.special.url.html', 'String')
355 | clear('@markup.link.markdown_inline')
356 | clear('@markup.link.label.markdown_inline')
357 | clear('@markup.link.url.markdown_inline')
358 | clear('@markup.raw.block.markdown')
359 | clear('@punctuation.special.markdown')
360 | clear('@markup.raw.block.vimdoc')
361 | end
362 | end
363 |
364 | function H.custom_groups(groups)
365 | for group, params in pairs(groups) do
366 | M.highlight(group, params.fg or {}, params.bg or {}, params.style or {})
367 | end
368 | end
369 |
370 | function H.terminal(theme)
371 | vim.g.terminal_color_foreground = FG.gui
372 | vim.g.terminal_color_background = BG.gui
373 |
374 | -- black
375 | vim.g.terminal_color_0 = theme.black
376 | vim.g.terminal_color_8 = theme.bright_black or theme.black
377 |
378 | -- red
379 | vim.g.terminal_color_1 = theme.red
380 | vim.g.terminal_color_9 = theme.bright_red or theme.red
381 |
382 | -- green
383 | vim.g.terminal_color_2 = theme.green
384 | vim.g.terminal_color_10 = theme.bright_green or theme.green
385 |
386 | -- yellow
387 | vim.g.terminal_color_3 = theme.yellow
388 | vim.g.terminal_color_11 = theme.bright_yellow or theme.yellow
389 |
390 | -- blue
391 | vim.g.terminal_color_4 = theme.blue
392 | vim.g.terminal_color_12 = theme.bright_blue or theme.blue
393 |
394 | -- magenta
395 | vim.g.terminal_color_5 = theme.magenta
396 | vim.g.terminal_color_13 = theme.bright_magenta or theme.magenta
397 |
398 | -- cyan
399 | vim.g.terminal_color_6 = theme.cyan
400 | vim.g.terminal_color_14 = theme.bright_cyan or theme.cyan
401 |
402 | -- white
403 | vim.g.terminal_color_7 = theme.white
404 | vim.g.terminal_color_15 = theme.bright_white or theme.white
405 | end
406 |
407 | function H.init(name, args)
408 | vim.cmd('hi clear')
409 | if vim.fn.exists('syntax_on') then
410 | vim.cmd('syntax reset')
411 | end
412 |
413 | vim.o.background = args.type
414 | vim.g.colors_name = name
415 | end
416 |
417 | function M.apply(name, theme)
418 | H.init(name, theme.globals)
419 | H.set_normal(theme.globals)
420 | H.ui(theme)
421 | H.base_syntax(theme.syntax)
422 | H.apply_links()
423 | H.terminal(theme.terminal)
424 | if theme.groups then
425 | H.custom_groups(theme.groups)
426 | end
427 | end
428 |
429 | function M.highlight(group, fg, bg, style)
430 | local opts = {}
431 |
432 | if fg.gui then
433 | opts.fg = fg.gui
434 | end
435 |
436 | if fg.cterm then
437 | opts.ctermfg = fg.cterm
438 | end
439 |
440 | if type(style) == 'table' then
441 | for _, item in ipairs(style) do
442 | opts[item] = true
443 | end
444 | end
445 |
446 | if bg == nil then
447 | opts.bg = 'NONE'
448 | opts.ctermbg = 'NONE'
449 | elseif type(bg) == 'table' then
450 | opts.bg = bg.gui
451 | opts.ctermbg = bg.cterm
452 | end
453 |
454 | vim.api.nvim_set_hl(0, group, opts)
455 | end
456 |
457 | function M.set_hl(group, style)
458 | vim.api.nvim_set_hl(0, group, style)
459 | end
460 |
461 | M.link = link
462 | M.NONE = none
463 |
464 | return M
465 |
466 |
--------------------------------------------------------------------------------