reladraw 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The named themes a file chooses with `diagram theme: <name>`, and the one it
3
+ * gets when it says nothing.
4
+ *
5
+ * A theme supplies every color the file does not state. It never supplies a
6
+ * size or a distance, so switching themes cannot move anything — geometry may
7
+ * not depend on appearance.
8
+ *
9
+ * Most of the palettes are borrowed from editor color schemes, all of them MIT
10
+ * licensed and credited in NOTICE. Those palettes were made for code, where a
11
+ * color marks a keyword or a string; a diagram needs a page, two box fills, a
12
+ * border, text and a line. So each is the scheme read as a diagram rather than
13
+ * a transfer of it: the page is the scheme's background, a leaf is its raised
14
+ * surface, a container sits between the two, and the lines take one of its
15
+ * accents.
16
+ */
17
+ export interface Theme {
18
+ background: string;
19
+ boxFill: string;
20
+ boxStroke: string;
21
+ containerFill: string;
22
+ /** A container is a region rather than a thing, so its outline is quieter. */
23
+ containerStroke: string;
24
+ text: string;
25
+ mutedText: string;
26
+ edge: string;
27
+ /** An icon's drawn line. */
28
+ iconInk: string;
29
+ /** The body an icon's lines enclose. */
30
+ iconShade: string;
31
+ }
32
+ /**
33
+ * Sampled out of `examples/reference/arch.png` rather than invented,
34
+ * so the benchmark render and the drawing it is measured against differ by
35
+ * geometry and typography alone. A container is a shade off the page and barely
36
+ * outlined; a leaf is the navy that carries the diagram's weight.
37
+ */
38
+ export declare const DARK_THEME: Theme;
39
+ /**
40
+ * Every theme a file may name, in the order they are offered. Pairs sit
41
+ * together, dark first, and the two that have no light half follow them.
42
+ */
43
+ export declare const THEMES: Readonly<Record<string, Theme>>;
44
+ /** The theme a file gets when it names none. */
45
+ export declare const DEFAULT_THEME = "dark";
46
+ export declare const THEME_NAMES: readonly string[];
package/dist/themes.js ADDED
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Sampled out of `examples/reference/arch.png` rather than invented,
3
+ * so the benchmark render and the drawing it is measured against differ by
4
+ * geometry and typography alone. A container is a shade off the page and barely
5
+ * outlined; a leaf is the navy that carries the diagram's weight.
6
+ */
7
+ export const DARK_THEME = {
8
+ background: '#111111',
9
+ boxFill: '#191728',
10
+ boxStroke: '#4f5367',
11
+ containerFill: '#191920',
12
+ containerStroke: '#25242f',
13
+ text: '#d9d9d9',
14
+ mutedText: '#8b8b8b',
15
+ edge: '#5c5c7c',
16
+ // Both sampled off the reference's machine glyphs. Note that the reference
17
+ // gives each icon its own hue — the drive is gray, the laptop periwinkle, the
18
+ // workstation violet — which is a drawing tool's per-shape default and not a
19
+ // system. One pair for the whole set is the deliberate difference: an icon
20
+ // should read as part of the diagram's palette, not as clip art dropped in.
21
+ iconInk: '#8d8d8e',
22
+ iconShade: '#3e3d58',
23
+ };
24
+ /** The dark theme's counterpart: the same roles, on a white page. */
25
+ const LIGHT_THEME = {
26
+ background: '#ffffff',
27
+ boxFill: '#eef0f7',
28
+ boxStroke: '#8a90a8',
29
+ containerFill: '#f6f7fa',
30
+ containerStroke: '#dcdfe7',
31
+ text: '#1f2328',
32
+ mutedText: '#6e7781',
33
+ edge: '#7c83a0',
34
+ iconInk: '#57606a',
35
+ iconShade: '#d6d9e6',
36
+ };
37
+ /**
38
+ * Every theme a file may name, in the order they are offered. Pairs sit
39
+ * together, dark first, and the two that have no light half follow them.
40
+ */
41
+ export const THEMES = {
42
+ dark: DARK_THEME,
43
+ light: LIGHT_THEME,
44
+ // Solarized, Ethan Schoonover. base03 page, base02 leaves, blue lines.
45
+ 'solarized-dark': {
46
+ background: '#002b36',
47
+ boxFill: '#073642',
48
+ boxStroke: '#586e75',
49
+ containerFill: '#03313c',
50
+ containerStroke: '#0b3f4c',
51
+ text: '#93a1a1',
52
+ mutedText: '#657b83',
53
+ edge: '#268bd2',
54
+ iconInk: '#839496',
55
+ iconShade: '#0f4a58',
56
+ },
57
+ // base3 page, base2 leaves, the same blue.
58
+ 'solarized-light': {
59
+ background: '#fdf6e3',
60
+ boxFill: '#eee8d5',
61
+ boxStroke: '#93a1a1',
62
+ containerFill: '#f6efdc',
63
+ containerStroke: '#e3dcc7',
64
+ text: '#586e75',
65
+ mutedText: '#93a1a1',
66
+ edge: '#268bd2',
67
+ iconInk: '#657b83',
68
+ iconShade: '#e0d9c3',
69
+ },
70
+ // Gruvbox, Pavel Pertsev. bg0 page, bg1 leaves, the warm yellow for lines.
71
+ 'gruvbox-dark': {
72
+ background: '#282828',
73
+ boxFill: '#3c3836',
74
+ boxStroke: '#665c54',
75
+ containerFill: '#32302f',
76
+ containerStroke: '#3c3836',
77
+ text: '#ebdbb2',
78
+ mutedText: '#a89984',
79
+ edge: '#d79921',
80
+ iconInk: '#a89984',
81
+ iconShade: '#504945',
82
+ },
83
+ 'gruvbox-light': {
84
+ background: '#fbf1c7',
85
+ boxFill: '#ebdbb2',
86
+ boxStroke: '#bdae93',
87
+ containerFill: '#f2e5bc',
88
+ containerStroke: '#e5d4a7',
89
+ text: '#3c3836',
90
+ mutedText: '#7c6f64',
91
+ edge: '#b57614',
92
+ iconInk: '#7c6f64',
93
+ iconShade: '#d5c4a1',
94
+ },
95
+ // Catppuccin. Mocha's base page and surface leaves, blue lines.
96
+ 'catppuccin-mocha': {
97
+ background: '#1e1e2e',
98
+ boxFill: '#313244',
99
+ boxStroke: '#6c7086',
100
+ containerFill: '#25253a',
101
+ containerStroke: '#313244',
102
+ text: '#cdd6f4',
103
+ mutedText: '#9399b2',
104
+ edge: '#89b4fa',
105
+ iconInk: '#a6adc8',
106
+ iconShade: '#45475a',
107
+ },
108
+ // Latte's base page and crust leaves, lavender lines.
109
+ 'catppuccin-latte': {
110
+ background: '#eff1f5',
111
+ boxFill: '#dce0e8',
112
+ boxStroke: '#9ca0b0',
113
+ containerFill: '#e6e9ef',
114
+ containerStroke: '#ccd0da',
115
+ text: '#4c4f69',
116
+ mutedText: '#7c7f93',
117
+ edge: '#7287fd',
118
+ iconInk: '#6c6f85',
119
+ iconShade: '#ccd0da',
120
+ },
121
+ // Nord, Sven Greb. Polar Night page and leaves, Frost lines.
122
+ nord: {
123
+ background: '#2e3440',
124
+ boxFill: '#3b4252',
125
+ boxStroke: '#4c566a',
126
+ containerFill: '#333a47',
127
+ containerStroke: '#3b4252',
128
+ text: '#d8dee9',
129
+ mutedText: '#7b88a1',
130
+ edge: '#81a1c1',
131
+ iconInk: '#aeb7c6',
132
+ iconShade: '#434c5e',
133
+ },
134
+ // Dracula, the free palette. Current-line leaves, comment borders, purple lines.
135
+ dracula: {
136
+ background: '#282a36',
137
+ boxFill: '#44475a',
138
+ boxStroke: '#6272a4',
139
+ containerFill: '#21222c',
140
+ containerStroke: '#343746',
141
+ text: '#f8f8f2',
142
+ mutedText: '#6272a4',
143
+ edge: '#bd93f9',
144
+ iconInk: '#b6b9cc',
145
+ iconShade: '#565a70',
146
+ },
147
+ // For low vision and projectors: no fills to lean on, every line at full
148
+ // strength, and a container told apart by a gray outline alone.
149
+ 'high-contrast-dark': {
150
+ background: '#000000',
151
+ boxFill: '#000000',
152
+ boxStroke: '#ffffff',
153
+ containerFill: '#000000',
154
+ containerStroke: '#9a9a9a',
155
+ text: '#ffffff',
156
+ mutedText: '#c8c8c8',
157
+ edge: '#ffffff',
158
+ iconInk: '#ffffff',
159
+ iconShade: '#3a3a3a',
160
+ },
161
+ 'high-contrast-light': {
162
+ background: '#ffffff',
163
+ boxFill: '#ffffff',
164
+ boxStroke: '#000000',
165
+ containerFill: '#ffffff',
166
+ containerStroke: '#6a6a6a',
167
+ text: '#000000',
168
+ mutedText: '#3d3d3d',
169
+ edge: '#000000',
170
+ iconInk: '#000000',
171
+ iconShade: '#d0d0d0',
172
+ },
173
+ // For paper: no fill anywhere an ink cartridge would notice, black lines,
174
+ // gray only where the dark theme is quiet.
175
+ print: {
176
+ background: '#ffffff',
177
+ boxFill: '#ffffff',
178
+ boxStroke: '#000000',
179
+ containerFill: '#ffffff',
180
+ containerStroke: '#8c8c8c',
181
+ text: '#000000',
182
+ mutedText: '#666666',
183
+ edge: '#333333',
184
+ iconInk: '#000000',
185
+ iconShade: '#ffffff',
186
+ },
187
+ };
188
+ /** The theme a file gets when it names none. */
189
+ export const DEFAULT_THEME = 'dark';
190
+ export const THEME_NAMES = Object.keys(THEMES);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reladraw",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "A diagram language where you say where things go.",
5
5
  "type": "module",
6
6
  "bin": {