Commit 49ec0ad 1 parent 5db7e2a commit 49ec0ad Copy full SHA for 49ec0ad
File tree 4 files changed +20
-77
lines changed
4 files changed +20
-77
lines changed Original file line number Diff line number Diff line change 1
1
{ lib } : let
2
2
inherit ( lib ) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption mkOptionType ;
3
- inherit ( lib . strings ) isString hasPrefix ;
3
+ inherit ( lib . strings ) isString ;
4
4
inherit ( lib . types ) anything attrsOf ;
5
5
inherit ( lib . nvim . types ) anythingConcatLists ;
6
6
inherit ( builtins ) typeOf isAttrs any head concatLists stringLength match ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 5
5
inherit ( lib . strings ) optionalString ;
6
6
inherit ( lib . trivial ) boolToString warnIf ;
7
7
inherit ( lib . nvim . lua ) toLuaObject ;
8
- cfg = config . vim . theme ;
9
8
in {
10
9
base16 = {
11
10
setup = { base16-colors , ...} : ''
12
- -- Base-16 theme
13
- require('base16-colorscheme').setup(${ toLuaObject cfg . base16-colors } )
11
+ -- Base16 theme
12
+ require('base16-colorscheme').setup(${ toLuaObject base16-colors } )
14
13
'' ;
15
14
} ;
16
15
onedark = {
Original file line number Diff line number Diff line change 3
3
lib ,
4
4
...
5
5
} : let
6
+ inherit ( builtins ) listToAttrs ;
6
7
inherit ( lib . options ) mkOption ;
7
8
inherit ( lib . attrsets ) attrNames ;
9
+ inherit ( lib . strings ) hasPrefix ;
8
10
inherit ( lib . types ) bool lines enum ;
9
11
inherit ( lib . modules ) mkIf ;
10
12
inherit ( lib . nvim . dag ) entryBefore ;
13
+ inherit ( lib . nvim . types ) hexColor ;
11
14
12
15
cfg = config . vim . theme ;
13
16
supportedThemes = import ./supported-themes.nix {
14
17
inherit lib config ;
15
18
} ;
16
- base16-colors = import ./base16-colors.nix {
17
- inherit lib ;
18
- } ;
19
+
20
+ numbers = lib . stringToCharacters "0123456789ABCDEF" ;
21
+ generateBase16Options = listToAttrs ( map ( i : {
22
+ name = "base0${ i } " ;
23
+ value = mkOption {
24
+ type = hexColor ;
25
+ apply = v :
26
+ if hasPrefix "#" v
27
+ then v
28
+ else "#${ v } " ;
29
+ } ;
30
+ } )
31
+ numbers ) ;
19
32
in {
20
33
options . vim . theme = {
21
34
enable = mkOption {
22
35
type = bool ;
23
36
description = "Enable theming" ;
24
37
} ;
25
- inherit base16-colors ;
26
38
name = mkOption {
27
39
type = enum ( attrNames supportedThemes ) ;
28
40
description = "Supported themes can be found in `supportedThemes.nix`" ;
29
41
} ;
42
+ base16-colors = generateBase16Options ;
30
43
31
44
style = mkOption {
32
45
type = enum supportedThemes . ${ cfg. name } . styles ;
You can’t perform that action at this time.
0 commit comments