-
Notifications
You must be signed in to change notification settings - Fork 2
/
guitar-fretboard.colors.sty
137 lines (114 loc) · 3.57 KB
/
guitar-fretboard.colors.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
%%
%% Copyright © 2018 by Sébastien Gross <seb -at- chezwam -dot- org>
%% This program is free software. It comes without any warranty, to the extent
%% permitted by applicable law. You can redistribute it and/or modify it under
%% the terms of the Do What The Fuck You Want To Public License, Version 2, as
%% published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
%% details.
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3c of this license
%% or (at your option) any later version. The latest version of this
%% license is in:
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2006/05/20 or later.
\RequirePackage{xcolor}
\RequirePackage{pgfkeys}
\RequirePackage{pgfmath}
\newif\iffb@color@derive
\pgfkeys{
/fb/colors/.cd,
limit/.initial = 0.5,
model/.initial = HTML,
derive/.is if = fb@color@derive,
derive = false,
}
%% #1 /fb/colors
%% #2 color index
%% #3 color definition
\newcommand{\FBnewColor}[3][]{
\pgfkeys{/fb/colors/.cd,
derive = false,
#1}
\iffb@color@derive%
\colorlet{bg#2}{#3}
\else
\definecolor{bg#2}{\pgfkeysvalueof{/fb/colors/model}}{#3}
\fi
% Compute foreground
%% https://tex.stackexchange.com/questions/379893
\extractcolorspecs{bg#2}{\modelspec}{\grayscale}
\convertcolorspec{\modelspec}{\grayscale}{rgb}\@tmp
\definecolor{RGBbg#2}{rgb}{\@tmp}
\extractcolorspecs{RGBbg#2}{\modelspec}{\grayscale}
\pgfmathparse{(
%% array({\grayscale},0)*0.299+
%% array({\grayscale},1)*0.587+
%% array({\grayscale},2)*0.114
array({\grayscale},0)*0.2126+
array({\grayscale},1)*0.7152+
array({\grayscale},2)*0.0722
)>=\pgfkeysvalueof{/fb/colors/limit}?int(1):int(0)}
\ifnum\pgfmathresult>0%
\colorlet{fg#2}{black}
\else % Less bright
\colorlet{fg#2}{white}
\fi
}
%% http://colorbrewer2.org/#type=qualitative&scheme=Set1&n=7
%% #e41a1c
%% #377eb8
%% #4daf4a
%% #984ea3
%% #ff7f00
%% #ffff33
%% #a65628
%%+ 10,90,80,0
%%+ 80,30,0,0
%%+ 70,0,80,0
%%+ 40,65,0,0
%% 0,50,100,0
%% 0,0,80,0
%% 35,60,80,0
\FBnewColor{1}{000000}
%\FBnewColor{1}{0,0,0,1}
\FBnewColor[derive]{1b} {bg1!10}
\FBnewColor[derive]{1bb}{bg1b!10}
\FBnewColor[derive]{1s} {bg1!10}
\FBnewColor[derive]{1ss}{bg1s!10}
\FBnewColor{2}{377EB8}
%\FBnewColor{2}{.80,.30,0,0}
\FBnewColor[derive]{2b} {bg2!70!black}
\FBnewColor[derive]{2bb}{bg2b!70!black}
\FBnewColor[derive]{2s} {bg2!30!white}
\FBnewColor[derive]{2ss}{bg2s!30!white}
\FBnewColor[limit=0.59]{3}{4DAF4A}
%\FBnewColor[limit=0.9]{3}{.70,.0,.80,0}
\FBnewColor[derive]{3b} {bg3!70!black}
\FBnewColor[derive]{3bb}{bg3b!70!black}
\FBnewColor[derive]{3s} {bg3!30!white}
\FBnewColor[derive]{3ss}{bg3s!30!white}
\FBnewColor{4}{984EA3}
%\FBnewColor{4}{.40,.65,0,0}
\FBnewColor[derive]{4b} {bg4!70!black}
\FBnewColor[derive]{4bb}{bg4b!70!black}
\FBnewColor[derive]{4s} {bg4!30!white}
\FBnewColor[derive]{4ss}{bg4s!30!white}
\FBnewColor{5}{E41A1C}
%\FBnewColor{5}{.10,.90,.80,0}
\FBnewColor[derive]{5b} {bg5!70!black}
\FBnewColor[derive]{5bb}{bg5b!70!black}
\FBnewColor[derive]{5s} {bg5!30!white}
\FBnewColor[derive]{5ss}{bg5s!30!white}
\FBnewColor{6}{FFFF33}
%\FBnewColor{6}{0,0,.80,0}
\FBnewColor[derive]{6b} {bg6!70!black}
\FBnewColor[derive]{6bb}{bg6b!70!black}
\FBnewColor[derive]{6s} {bg6!30!white}
\FBnewColor[derive]{6ss}{bg6s!30!white}
\FBnewColor{7}{A65628}
%\FBnewColor{7}{.35,.60,.80,0}
\FBnewColor[derive]{7b} {bg7!70!black}
\FBnewColor[derive]{7bb}{bg7b!70!black}
\FBnewColor[derive]{7s} {bg7!30!white}
\FBnewColor[derive]{7ss}{bg7s!30!white}