├── .github
└── workflows
│ ├── ci.yml
│ └── release-plz.yml
├── .gitignore
├── CHANGELOG.md
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── README.md
└── src
├── .gitignore
├── app.rs
├── color_data.rs
├── lib.rs
├── main.rs
└── ui.rs
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: Continuous Integration
2 |
3 | on:
4 | push:
5 | branches: ["master"]
6 | pull_request:
7 | branches: ["master"]
8 |
9 | env:
10 | CARGO_TERM_COLOR: always
11 |
12 | jobs:
13 | build:
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v4
17 | - name: Build
18 | run: cargo build --verbose
19 | - name: Run tests
20 | run: cargo test --verbose
21 |
--------------------------------------------------------------------------------
/.github/workflows/release-plz.yml:
--------------------------------------------------------------------------------
1 | name: Release-plz
2 | # see https://release-plz.ieni.dev/docs/github/quickstart for more information
3 |
4 | permissions:
5 | pull-requests: write
6 | contents: write
7 |
8 | on:
9 | push:
10 | branches:
11 | - master
12 |
13 | jobs:
14 | release-plz:
15 | name: Release-plz
16 | runs-on: ubuntu-latest
17 | steps:
18 | - name: Checkout repository
19 | uses: actions/checkout@v4
20 | with:
21 | fetch-depth: 0
22 | - name: Install Rust toolchain (stable)
23 | uses: dtolnay/rust-toolchain@stable
24 | - name: Run release-plz
25 | uses: MarcoIeni/release-plz-action@v0.5
26 | env:
27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 | CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
29 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | .DS_Store
3 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 | All notable changes to this project will be documented in this file.
3 |
4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6 |
7 | ## [Unreleased]
8 |
9 | ## [0.1.1](https://github.com/azorng/material/compare/v0.1.0...v0.1.1) - 2023-12-30
10 |
11 | ### Added
12 | - add accent color variants (A100...)
13 | - *(lib)* make it possible to use as a lib
14 | - *(ratatui)* migrate from tui-rs to ratatui
15 |
16 | ### Fixed
17 | - typos / feature flag in examples ([#6](https://github.com/azorng/material/pull/6))
18 |
19 | ### Other
20 | - add CI and release workflow ([#5](https://github.com/azorng/material/pull/5))
21 | - add install options
22 |
--------------------------------------------------------------------------------
/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | version = 3
4 |
5 | [[package]]
6 | name = "ahash"
7 | version = "0.8.6"
8 | source = "registry+https://github.com/rust-lang/crates.io-index"
9 | checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
10 | dependencies = [
11 | "cfg-if",
12 | "once_cell",
13 | "version_check",
14 | "zerocopy",
15 | ]
16 |
17 | [[package]]
18 | name = "allocator-api2"
19 | version = "0.2.16"
20 | source = "registry+https://github.com/rust-lang/crates.io-index"
21 | checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
22 |
23 | [[package]]
24 | name = "autocfg"
25 | version = "1.1.0"
26 | source = "registry+https://github.com/rust-lang/crates.io-index"
27 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
28 |
29 | [[package]]
30 | name = "bitflags"
31 | version = "1.3.2"
32 | source = "registry+https://github.com/rust-lang/crates.io-index"
33 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
34 |
35 | [[package]]
36 | name = "bitflags"
37 | version = "2.4.1"
38 | source = "registry+https://github.com/rust-lang/crates.io-index"
39 | checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
40 |
41 | [[package]]
42 | name = "block"
43 | version = "0.1.6"
44 | source = "registry+https://github.com/rust-lang/crates.io-index"
45 | checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
46 |
47 | [[package]]
48 | name = "cassowary"
49 | version = "0.3.0"
50 | source = "registry+https://github.com/rust-lang/crates.io-index"
51 | checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
52 |
53 | [[package]]
54 | name = "cfg-if"
55 | version = "1.0.0"
56 | source = "registry+https://github.com/rust-lang/crates.io-index"
57 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
58 |
59 | [[package]]
60 | name = "clipboard"
61 | version = "0.5.0"
62 | source = "registry+https://github.com/rust-lang/crates.io-index"
63 | checksum = "25a904646c0340239dcf7c51677b33928bf24fdf424b79a57909c0109075b2e7"
64 | dependencies = [
65 | "clipboard-win",
66 | "objc",
67 | "objc-foundation",
68 | "objc_id",
69 | "x11-clipboard",
70 | ]
71 |
72 | [[package]]
73 | name = "clipboard-win"
74 | version = "2.2.0"
75 | source = "registry+https://github.com/rust-lang/crates.io-index"
76 | checksum = "e3a093d6fed558e5fe24c3dfc85a68bb68f1c824f440d3ba5aca189e2998786b"
77 | dependencies = [
78 | "winapi",
79 | ]
80 |
81 | [[package]]
82 | name = "crossterm"
83 | version = "0.27.0"
84 | source = "registry+https://github.com/rust-lang/crates.io-index"
85 | checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
86 | dependencies = [
87 | "bitflags 2.4.1",
88 | "crossterm_winapi",
89 | "libc",
90 | "mio",
91 | "parking_lot",
92 | "signal-hook",
93 | "signal-hook-mio",
94 | "winapi",
95 | ]
96 |
97 | [[package]]
98 | name = "crossterm_winapi"
99 | version = "0.9.1"
100 | source = "registry+https://github.com/rust-lang/crates.io-index"
101 | checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
102 | dependencies = [
103 | "winapi",
104 | ]
105 |
106 | [[package]]
107 | name = "either"
108 | version = "1.9.0"
109 | source = "registry+https://github.com/rust-lang/crates.io-index"
110 | checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
111 |
112 | [[package]]
113 | name = "hashbrown"
114 | version = "0.14.3"
115 | source = "registry+https://github.com/rust-lang/crates.io-index"
116 | checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
117 | dependencies = [
118 | "ahash",
119 | "allocator-api2",
120 | ]
121 |
122 | [[package]]
123 | name = "heck"
124 | version = "0.4.1"
125 | source = "registry+https://github.com/rust-lang/crates.io-index"
126 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
127 |
128 | [[package]]
129 | name = "indoc"
130 | version = "2.0.4"
131 | source = "registry+https://github.com/rust-lang/crates.io-index"
132 | checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
133 |
134 | [[package]]
135 | name = "itertools"
136 | version = "0.12.0"
137 | source = "registry+https://github.com/rust-lang/crates.io-index"
138 | checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
139 | dependencies = [
140 | "either",
141 | ]
142 |
143 | [[package]]
144 | name = "libc"
145 | version = "0.2.151"
146 | source = "registry+https://github.com/rust-lang/crates.io-index"
147 | checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
148 |
149 | [[package]]
150 | name = "lock_api"
151 | version = "0.4.11"
152 | source = "registry+https://github.com/rust-lang/crates.io-index"
153 | checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
154 | dependencies = [
155 | "autocfg",
156 | "scopeguard",
157 | ]
158 |
159 | [[package]]
160 | name = "log"
161 | version = "0.4.20"
162 | source = "registry+https://github.com/rust-lang/crates.io-index"
163 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
164 |
165 | [[package]]
166 | name = "lru"
167 | version = "0.12.1"
168 | source = "registry+https://github.com/rust-lang/crates.io-index"
169 | checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7"
170 | dependencies = [
171 | "hashbrown",
172 | ]
173 |
174 | [[package]]
175 | name = "malloc_buf"
176 | version = "0.0.6"
177 | source = "registry+https://github.com/rust-lang/crates.io-index"
178 | checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
179 | dependencies = [
180 | "libc",
181 | ]
182 |
183 | [[package]]
184 | name = "material"
185 | version = "0.1.1"
186 | dependencies = [
187 | "clipboard",
188 | "crossterm",
189 | "ratatui",
190 | ]
191 |
192 | [[package]]
193 | name = "mio"
194 | version = "0.8.10"
195 | source = "registry+https://github.com/rust-lang/crates.io-index"
196 | checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
197 | dependencies = [
198 | "libc",
199 | "log",
200 | "wasi",
201 | "windows-sys",
202 | ]
203 |
204 | [[package]]
205 | name = "objc"
206 | version = "0.2.7"
207 | source = "registry+https://github.com/rust-lang/crates.io-index"
208 | checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
209 | dependencies = [
210 | "malloc_buf",
211 | ]
212 |
213 | [[package]]
214 | name = "objc-foundation"
215 | version = "0.1.1"
216 | source = "registry+https://github.com/rust-lang/crates.io-index"
217 | checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
218 | dependencies = [
219 | "block",
220 | "objc",
221 | "objc_id",
222 | ]
223 |
224 | [[package]]
225 | name = "objc_id"
226 | version = "0.1.1"
227 | source = "registry+https://github.com/rust-lang/crates.io-index"
228 | checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
229 | dependencies = [
230 | "objc",
231 | ]
232 |
233 | [[package]]
234 | name = "once_cell"
235 | version = "1.19.0"
236 | source = "registry+https://github.com/rust-lang/crates.io-index"
237 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
238 |
239 | [[package]]
240 | name = "parking_lot"
241 | version = "0.12.1"
242 | source = "registry+https://github.com/rust-lang/crates.io-index"
243 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
244 | dependencies = [
245 | "lock_api",
246 | "parking_lot_core",
247 | ]
248 |
249 | [[package]]
250 | name = "parking_lot_core"
251 | version = "0.9.9"
252 | source = "registry+https://github.com/rust-lang/crates.io-index"
253 | checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
254 | dependencies = [
255 | "cfg-if",
256 | "libc",
257 | "redox_syscall",
258 | "smallvec",
259 | "windows-targets",
260 | ]
261 |
262 | [[package]]
263 | name = "paste"
264 | version = "1.0.14"
265 | source = "registry+https://github.com/rust-lang/crates.io-index"
266 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
267 |
268 | [[package]]
269 | name = "proc-macro2"
270 | version = "1.0.71"
271 | source = "registry+https://github.com/rust-lang/crates.io-index"
272 | checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8"
273 | dependencies = [
274 | "unicode-ident",
275 | ]
276 |
277 | [[package]]
278 | name = "quote"
279 | version = "1.0.33"
280 | source = "registry+https://github.com/rust-lang/crates.io-index"
281 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
282 | dependencies = [
283 | "proc-macro2",
284 | ]
285 |
286 | [[package]]
287 | name = "ratatui"
288 | version = "0.25.0"
289 | source = "registry+https://github.com/rust-lang/crates.io-index"
290 | checksum = "a5659e52e4ba6e07b2dad9f1158f578ef84a73762625ddb51536019f34d180eb"
291 | dependencies = [
292 | "bitflags 2.4.1",
293 | "cassowary",
294 | "crossterm",
295 | "indoc",
296 | "itertools",
297 | "lru",
298 | "paste",
299 | "stability",
300 | "strum",
301 | "unicode-segmentation",
302 | "unicode-width",
303 | ]
304 |
305 | [[package]]
306 | name = "redox_syscall"
307 | version = "0.4.1"
308 | source = "registry+https://github.com/rust-lang/crates.io-index"
309 | checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
310 | dependencies = [
311 | "bitflags 1.3.2",
312 | ]
313 |
314 | [[package]]
315 | name = "rustversion"
316 | version = "1.0.14"
317 | source = "registry+https://github.com/rust-lang/crates.io-index"
318 | checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
319 |
320 | [[package]]
321 | name = "scopeguard"
322 | version = "1.2.0"
323 | source = "registry+https://github.com/rust-lang/crates.io-index"
324 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
325 |
326 | [[package]]
327 | name = "signal-hook"
328 | version = "0.3.17"
329 | source = "registry+https://github.com/rust-lang/crates.io-index"
330 | checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801"
331 | dependencies = [
332 | "libc",
333 | "signal-hook-registry",
334 | ]
335 |
336 | [[package]]
337 | name = "signal-hook-mio"
338 | version = "0.2.3"
339 | source = "registry+https://github.com/rust-lang/crates.io-index"
340 | checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af"
341 | dependencies = [
342 | "libc",
343 | "mio",
344 | "signal-hook",
345 | ]
346 |
347 | [[package]]
348 | name = "signal-hook-registry"
349 | version = "1.4.1"
350 | source = "registry+https://github.com/rust-lang/crates.io-index"
351 | checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
352 | dependencies = [
353 | "libc",
354 | ]
355 |
356 | [[package]]
357 | name = "smallvec"
358 | version = "1.11.2"
359 | source = "registry+https://github.com/rust-lang/crates.io-index"
360 | checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
361 |
362 | [[package]]
363 | name = "stability"
364 | version = "0.1.1"
365 | source = "registry+https://github.com/rust-lang/crates.io-index"
366 | checksum = "ebd1b177894da2a2d9120208c3386066af06a488255caabc5de8ddca22dbc3ce"
367 | dependencies = [
368 | "quote",
369 | "syn 1.0.109",
370 | ]
371 |
372 | [[package]]
373 | name = "strum"
374 | version = "0.25.0"
375 | source = "registry+https://github.com/rust-lang/crates.io-index"
376 | checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
377 | dependencies = [
378 | "strum_macros",
379 | ]
380 |
381 | [[package]]
382 | name = "strum_macros"
383 | version = "0.25.3"
384 | source = "registry+https://github.com/rust-lang/crates.io-index"
385 | checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
386 | dependencies = [
387 | "heck",
388 | "proc-macro2",
389 | "quote",
390 | "rustversion",
391 | "syn 2.0.43",
392 | ]
393 |
394 | [[package]]
395 | name = "syn"
396 | version = "1.0.109"
397 | source = "registry+https://github.com/rust-lang/crates.io-index"
398 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
399 | dependencies = [
400 | "proc-macro2",
401 | "quote",
402 | "unicode-ident",
403 | ]
404 |
405 | [[package]]
406 | name = "syn"
407 | version = "2.0.43"
408 | source = "registry+https://github.com/rust-lang/crates.io-index"
409 | checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53"
410 | dependencies = [
411 | "proc-macro2",
412 | "quote",
413 | "unicode-ident",
414 | ]
415 |
416 | [[package]]
417 | name = "unicode-ident"
418 | version = "1.0.12"
419 | source = "registry+https://github.com/rust-lang/crates.io-index"
420 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
421 |
422 | [[package]]
423 | name = "unicode-segmentation"
424 | version = "1.10.1"
425 | source = "registry+https://github.com/rust-lang/crates.io-index"
426 | checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
427 |
428 | [[package]]
429 | name = "unicode-width"
430 | version = "0.1.11"
431 | source = "registry+https://github.com/rust-lang/crates.io-index"
432 | checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
433 |
434 | [[package]]
435 | name = "version_check"
436 | version = "0.9.4"
437 | source = "registry+https://github.com/rust-lang/crates.io-index"
438 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
439 |
440 | [[package]]
441 | name = "wasi"
442 | version = "0.11.0+wasi-snapshot-preview1"
443 | source = "registry+https://github.com/rust-lang/crates.io-index"
444 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
445 |
446 | [[package]]
447 | name = "winapi"
448 | version = "0.3.9"
449 | source = "registry+https://github.com/rust-lang/crates.io-index"
450 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
451 | dependencies = [
452 | "winapi-i686-pc-windows-gnu",
453 | "winapi-x86_64-pc-windows-gnu",
454 | ]
455 |
456 | [[package]]
457 | name = "winapi-i686-pc-windows-gnu"
458 | version = "0.4.0"
459 | source = "registry+https://github.com/rust-lang/crates.io-index"
460 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
461 |
462 | [[package]]
463 | name = "winapi-x86_64-pc-windows-gnu"
464 | version = "0.4.0"
465 | source = "registry+https://github.com/rust-lang/crates.io-index"
466 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
467 |
468 | [[package]]
469 | name = "windows-sys"
470 | version = "0.48.0"
471 | source = "registry+https://github.com/rust-lang/crates.io-index"
472 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
473 | dependencies = [
474 | "windows-targets",
475 | ]
476 |
477 | [[package]]
478 | name = "windows-targets"
479 | version = "0.48.5"
480 | source = "registry+https://github.com/rust-lang/crates.io-index"
481 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
482 | dependencies = [
483 | "windows_aarch64_gnullvm",
484 | "windows_aarch64_msvc",
485 | "windows_i686_gnu",
486 | "windows_i686_msvc",
487 | "windows_x86_64_gnu",
488 | "windows_x86_64_gnullvm",
489 | "windows_x86_64_msvc",
490 | ]
491 |
492 | [[package]]
493 | name = "windows_aarch64_gnullvm"
494 | version = "0.48.5"
495 | source = "registry+https://github.com/rust-lang/crates.io-index"
496 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
497 |
498 | [[package]]
499 | name = "windows_aarch64_msvc"
500 | version = "0.48.5"
501 | source = "registry+https://github.com/rust-lang/crates.io-index"
502 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
503 |
504 | [[package]]
505 | name = "windows_i686_gnu"
506 | version = "0.48.5"
507 | source = "registry+https://github.com/rust-lang/crates.io-index"
508 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
509 |
510 | [[package]]
511 | name = "windows_i686_msvc"
512 | version = "0.48.5"
513 | source = "registry+https://github.com/rust-lang/crates.io-index"
514 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
515 |
516 | [[package]]
517 | name = "windows_x86_64_gnu"
518 | version = "0.48.5"
519 | source = "registry+https://github.com/rust-lang/crates.io-index"
520 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
521 |
522 | [[package]]
523 | name = "windows_x86_64_gnullvm"
524 | version = "0.48.5"
525 | source = "registry+https://github.com/rust-lang/crates.io-index"
526 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
527 |
528 | [[package]]
529 | name = "windows_x86_64_msvc"
530 | version = "0.48.5"
531 | source = "registry+https://github.com/rust-lang/crates.io-index"
532 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
533 |
534 | [[package]]
535 | name = "x11-clipboard"
536 | version = "0.3.3"
537 | source = "registry+https://github.com/rust-lang/crates.io-index"
538 | checksum = "89bd49c06c9eb5d98e6ba6536cf64ac9f7ee3a009b2f53996d405b3944f6bcea"
539 | dependencies = [
540 | "xcb",
541 | ]
542 |
543 | [[package]]
544 | name = "xcb"
545 | version = "0.8.2"
546 | source = "registry+https://github.com/rust-lang/crates.io-index"
547 | checksum = "5e917a3f24142e9ff8be2414e36c649d47d6cc2ba81f16201cdef96e533e02de"
548 | dependencies = [
549 | "libc",
550 | "log",
551 | ]
552 |
553 | [[package]]
554 | name = "zerocopy"
555 | version = "0.7.32"
556 | source = "registry+https://github.com/rust-lang/crates.io-index"
557 | checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
558 | dependencies = [
559 | "zerocopy-derive",
560 | ]
561 |
562 | [[package]]
563 | name = "zerocopy-derive"
564 | version = "0.7.32"
565 | source = "registry+https://github.com/rust-lang/crates.io-index"
566 | checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
567 | dependencies = [
568 | "proc-macro2",
569 | "quote",
570 | "syn 2.0.43",
571 | ]
572 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "material"
3 | description = "A material design color palette for the terminal"
4 | version = "0.1.1"
5 | edition = "2021"
6 | repository = "https://github.com/azorng/material"
7 | readme = "README.md"
8 | keywords = ["cli", "color", "terminal", "palette", "material-design"]
9 | license = "MIT"
10 |
11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
12 |
13 | [package.metadata.docs.rs]
14 | all-features = true
15 |
16 | [dependencies]
17 | ratatui = { version = "0.25.0", optional = true }
18 | crossterm = { version = "0.27.0", optional = true }
19 | clipboard = "0.5.0"
20 |
21 | [[bin]]
22 | # necessary to avoid including crossterm / ratatui in the lib
23 | name = "material"
24 | required-features = ["cli"]
25 |
26 | [features]
27 | cli = ["ratatui", "crossterm"]
28 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 azorng
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.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Material
2 |
3 | A material design color palette for the terminal
4 |
5 |
6 |
7 | ## Installation
8 |
9 | ### Homebrew
10 |
11 | ```bash
12 | brew tap azorng/material
13 | brew install material
14 | ```
15 |
16 | ### Cargo
17 |
18 | First, install [Rust](https://www.rust-lang.org/tools/install) (using the recommended `rustup` installation method) and then
19 |
20 | ```bash
21 | cargo install material --locked --features=cli
22 | ```
23 |
24 | ## Usage
25 |
26 | Run the command ``material`` in the terminal.
27 | Type the color code to copy its hex color to the clipboard. Type Esc to exit.
28 |
29 | ## As a library
30 |
31 | This crate can also be used as a library in your own apps.
32 |
33 | ```bash
34 | cargo add material
35 | ```
36 |
37 | ```rust
38 | use material_colors::colors;
39 |
40 | assert_eq!(colors::RED_50.to_string(), "#ffebee");
41 | assert_eq!(colors::RED_100.to_string(), "#ffcdd2");
42 | ```
43 |
44 | ### From Ratatui
45 |
46 | Colors provided by the library can be converted to [Ratatui](https://ratatui.rs) colors. Just
47 | enable the `ratatui` feature.
48 |
49 | ```bash
50 | cargo add material --features=ratatui
51 | ```
52 |
53 | ```rust
54 | use material_colors::colors;
55 | use ratatui::prelude::*;
56 |
57 | let line = Line::styled("hello world", Style::new().fg(colors::RED_50.into()));
58 | ```
59 |
--------------------------------------------------------------------------------
/src/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azorng/material/0f70757f729c62c7b4992edacb0019e7e4f5a80b/src/.gitignore
--------------------------------------------------------------------------------
/src/app.rs:
--------------------------------------------------------------------------------
1 | use crate::color_data::{Colors, COLOR_DATA};
2 | use clipboard::ClipboardContext;
3 | use clipboard::ClipboardProvider;
4 |
5 | pub struct App {
6 | pub message: String,
7 | pub input: String,
8 | pub colors: &'static Colors,
9 | }
10 |
11 | impl App {
12 | pub fn new() -> Self {
13 | App {
14 | message: String::new(),
15 | input: String::new(),
16 | colors: &COLOR_DATA,
17 | }
18 | }
19 |
20 | pub fn handle_input(&mut self, c: char) {
21 | if self.input.len() == 2 {
22 | self.input = String::new();
23 | }
24 | self.input.push(c);
25 | if self.input.len() == 2 {
26 | self.color_search();
27 | }
28 | }
29 |
30 | pub fn delete_input(&mut self) {
31 | self.input.pop();
32 | }
33 |
34 | fn color_search(&mut self) {
35 | self.colors.iter().for_each(|color| {
36 | color.iter().for_each(|color_variant| {
37 | if color_variant.0.to_lowercase() == self.input.to_lowercase() {
38 | let mut ctx: ClipboardContext = ClipboardProvider::new().unwrap();
39 | ctx.set_contents(color_variant.1.to_string()).unwrap();
40 | self.message = format!("{} copied to clipboard!", color_variant.1);
41 | }
42 | })
43 | });
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/color_data.rs:
--------------------------------------------------------------------------------
1 | use material::{colors::*, HexColor};
2 |
3 | pub const N_VARIANTS: usize = 14;
4 | pub const N_COLORS: usize = 19;
5 |
6 | type Color = (&'static str, HexColor);
7 | type ColorVariants = &'static [Color];
8 | pub type Colors = [ColorVariants; N_COLORS];
9 |
10 | pub const COLOR_DATA: Colors = [
11 | &[
12 | ("A0", RED_50),
13 | ("A1", RED_100),
14 | ("A2", RED_200),
15 | ("A3", RED_300),
16 | ("A4", RED_400),
17 | ("A5", RED_500),
18 | ("A6", RED_600),
19 | ("A7", RED_700),
20 | ("A8", RED_800),
21 | ("A9", RED_900),
22 | ("AA", RED_A100),
23 | ("AB", RED_A200),
24 | ("AC", RED_A400),
25 | ("AD", RED_A700),
26 | ],
27 | &[
28 | ("B0", PINK_50),
29 | ("B1", PINK_100),
30 | ("B2", PINK_200),
31 | ("B3", PINK_300),
32 | ("B4", PINK_400),
33 | ("B5", PINK_500),
34 | ("B6", PINK_600),
35 | ("B7", PINK_700),
36 | ("B8", PINK_800),
37 | ("B9", PINK_900),
38 | ("BA", PINK_A100),
39 | ("BB", PINK_A200),
40 | ("BC", PINK_A400),
41 | ("BD", PINK_A700),
42 | ],
43 | &[
44 | ("C0", PURPLE_50),
45 | ("C1", PURPLE_100),
46 | ("C2", PURPLE_200),
47 | ("C3", PURPLE_300),
48 | ("C4", PURPLE_400),
49 | ("C5", PURPLE_500),
50 | ("C6", PURPLE_600),
51 | ("C7", PURPLE_700),
52 | ("C8", PURPLE_800),
53 | ("C9", PURPLE_900),
54 | ("CA", PURPLE_A100),
55 | ("CB", PURPLE_A200),
56 | ("CC", PURPLE_A400),
57 | ("CD", PURPLE_A700),
58 | ],
59 | &[
60 | ("D0", DEEP_PURPLE_50),
61 | ("D1", DEEP_PURPLE_100),
62 | ("D2", DEEP_PURPLE_200),
63 | ("D3", DEEP_PURPLE_300),
64 | ("D4", DEEP_PURPLE_400),
65 | ("D5", DEEP_PURPLE_500),
66 | ("D6", DEEP_PURPLE_600),
67 | ("D7", DEEP_PURPLE_700),
68 | ("D8", DEEP_PURPLE_800),
69 | ("D9", DEEP_PURPLE_900),
70 | ("DA", DEEP_PURPLE_A100),
71 | ("DB", DEEP_PURPLE_A200),
72 | ("DC", DEEP_PURPLE_A400),
73 | ("DD", DEEP_PURPLE_A700),
74 | ],
75 | &[
76 | ("E0", INDIGO_50),
77 | ("E1", INDIGO_100),
78 | ("E2", INDIGO_200),
79 | ("E3", INDIGO_300),
80 | ("E4", INDIGO_400),
81 | ("E5", INDIGO_500),
82 | ("E6", INDIGO_600),
83 | ("E7", INDIGO_700),
84 | ("E8", INDIGO_800),
85 | ("E9", INDIGO_900),
86 | ("EA", INDIGO_A100),
87 | ("EB", INDIGO_A200),
88 | ("EC", INDIGO_A400),
89 | ("ED", INDIGO_A700),
90 | ],
91 | &[
92 | ("F0", BLUE_50),
93 | ("F1", BLUE_100),
94 | ("F2", BLUE_200),
95 | ("F3", BLUE_300),
96 | ("F4", BLUE_400),
97 | ("F5", BLUE_500),
98 | ("F6", BLUE_600),
99 | ("F7", BLUE_700),
100 | ("F8", BLUE_800),
101 | ("F9", BLUE_900),
102 | ("FA", BLUE_A100),
103 | ("FB", BLUE_A200),
104 | ("FC", BLUE_A400),
105 | ("FD", BLUE_A700),
106 | ],
107 | &[
108 | ("G0", LIGHT_BLUE_50),
109 | ("G1", LIGHT_BLUE_100),
110 | ("G2", LIGHT_BLUE_200),
111 | ("G3", LIGHT_BLUE_300),
112 | ("G4", LIGHT_BLUE_400),
113 | ("G5", LIGHT_BLUE_500),
114 | ("G6", LIGHT_BLUE_600),
115 | ("G7", LIGHT_BLUE_700),
116 | ("G8", LIGHT_BLUE_800),
117 | ("G9", LIGHT_BLUE_900),
118 | ("GA", LIGHT_BLUE_A100),
119 | ("GB", LIGHT_BLUE_A200),
120 | ("GC", LIGHT_BLUE_A400),
121 | ("GD", LIGHT_BLUE_A700),
122 | ],
123 | &[
124 | ("H0", CYAN_50),
125 | ("H1", CYAN_100),
126 | ("H2", CYAN_200),
127 | ("H3", CYAN_300),
128 | ("H4", CYAN_400),
129 | ("H5", CYAN_500),
130 | ("H6", CYAN_600),
131 | ("H7", CYAN_700),
132 | ("H8", CYAN_800),
133 | ("H9", CYAN_900),
134 | ("HA", CYAN_A100),
135 | ("HB", CYAN_A200),
136 | ("HC", CYAN_A400),
137 | ("HD", CYAN_A700),
138 | ],
139 | &[
140 | ("I0", TEAL_50),
141 | ("I1", TEAL_100),
142 | ("I2", TEAL_200),
143 | ("I3", TEAL_300),
144 | ("I4", TEAL_400),
145 | ("I5", TEAL_500),
146 | ("I6", TEAL_600),
147 | ("I7", TEAL_700),
148 | ("I8", TEAL_800),
149 | ("I9", TEAL_900),
150 | ("IA", TEAL_A100),
151 | ("IB", TEAL_A200),
152 | ("IC", TEAL_A400),
153 | ("ID", TEAL_A700),
154 | ],
155 | &[
156 | ("J0", GREEN_50),
157 | ("J1", GREEN_100),
158 | ("J2", GREEN_200),
159 | ("J3", GREEN_300),
160 | ("J4", GREEN_400),
161 | ("J5", GREEN_500),
162 | ("J6", GREEN_600),
163 | ("J7", GREEN_700),
164 | ("J8", GREEN_800),
165 | ("J9", GREEN_900),
166 | ("JA", GREEN_A100),
167 | ("JB", GREEN_A200),
168 | ("JC", GREEN_A400),
169 | ("JD", GREEN_A700),
170 | ],
171 | &[
172 | ("K0", LIGHT_GREEN_50),
173 | ("K1", LIGHT_GREEN_100),
174 | ("K2", LIGHT_GREEN_200),
175 | ("K3", LIGHT_GREEN_300),
176 | ("K4", LIGHT_GREEN_400),
177 | ("K5", LIGHT_GREEN_500),
178 | ("K6", LIGHT_GREEN_600),
179 | ("K7", LIGHT_GREEN_700),
180 | ("K8", LIGHT_GREEN_800),
181 | ("K9", LIGHT_GREEN_900),
182 | ("KA", LIGHT_GREEN_A100),
183 | ("KB", LIGHT_GREEN_A200),
184 | ("KC", LIGHT_GREEN_A400),
185 | ("KD", LIGHT_GREEN_A700),
186 | ],
187 | &[
188 | ("L0", LIME_50),
189 | ("L1", LIME_100),
190 | ("L2", LIME_200),
191 | ("L3", LIME_300),
192 | ("L4", LIME_400),
193 | ("L5", LIME_500),
194 | ("L6", LIME_600),
195 | ("L7", LIME_700),
196 | ("L8", LIME_800),
197 | ("L9", LIME_900),
198 | ("LA", LIME_A100),
199 | ("LB", LIME_A200),
200 | ("LC", LIME_A400),
201 | ("LD", LIME_A700),
202 | ],
203 | &[
204 | ("M0", YELLOW_50),
205 | ("M1", YELLOW_100),
206 | ("M2", YELLOW_200),
207 | ("M3", YELLOW_300),
208 | ("M4", YELLOW_400),
209 | ("M5", YELLOW_500),
210 | ("M6", YELLOW_600),
211 | ("M7", YELLOW_700),
212 | ("M8", YELLOW_800),
213 | ("M9", YELLOW_900),
214 | ("MA", YELLOW_A100),
215 | ("MB", YELLOW_A200),
216 | ("MC", YELLOW_A400),
217 | ("MD", YELLOW_A700),
218 | ],
219 | &[
220 | ("N0", AMBER_50),
221 | ("N1", AMBER_100),
222 | ("N2", AMBER_200),
223 | ("N3", AMBER_300),
224 | ("N4", AMBER_400),
225 | ("N5", AMBER_500),
226 | ("N6", AMBER_600),
227 | ("N7", AMBER_700),
228 | ("N8", AMBER_800),
229 | ("N9", AMBER_900),
230 | ("NA", AMBER_A100),
231 | ("NB", AMBER_A200),
232 | ("NC", AMBER_A400),
233 | ("ND", AMBER_A700),
234 | ],
235 | &[
236 | ("O0", ORANGE_50),
237 | ("O1", ORANGE_100),
238 | ("O2", ORANGE_200),
239 | ("O3", ORANGE_300),
240 | ("O4", ORANGE_400),
241 | ("O5", ORANGE_500),
242 | ("O6", ORANGE_600),
243 | ("O7", ORANGE_700),
244 | ("O8", ORANGE_800),
245 | ("O9", ORANGE_900),
246 | ("OA", ORANGE_A100),
247 | ("OB", ORANGE_A200),
248 | ("OC", ORANGE_A400),
249 | ("OD", ORANGE_A700),
250 | ],
251 | &[
252 | ("P0", DEEP_ORANGE_50),
253 | ("P1", DEEP_ORANGE_100),
254 | ("P2", DEEP_ORANGE_200),
255 | ("P3", DEEP_ORANGE_300),
256 | ("P4", DEEP_ORANGE_400),
257 | ("P5", DEEP_ORANGE_500),
258 | ("P6", DEEP_ORANGE_600),
259 | ("P7", DEEP_ORANGE_700),
260 | ("P8", DEEP_ORANGE_800),
261 | ("P9", DEEP_ORANGE_900),
262 | ("PA", DEEP_ORANGE_A100),
263 | ("PB", DEEP_ORANGE_A200),
264 | ("PC", DEEP_ORANGE_A400),
265 | ("PD", DEEP_ORANGE_A700),
266 | ],
267 | &[
268 | ("Q0", BROWN_50),
269 | ("Q1", BROWN_100),
270 | ("Q2", BROWN_200),
271 | ("Q3", BROWN_300),
272 | ("Q4", BROWN_400),
273 | ("Q5", BROWN_500),
274 | ("Q6", BROWN_600),
275 | ("Q7", BROWN_700),
276 | ("Q8", BROWN_800),
277 | ("Q9", BROWN_900),
278 | ],
279 | &[
280 | ("R0", GREY_50),
281 | ("R1", GREY_100),
282 | ("R2", GREY_200),
283 | ("R3", GREY_300),
284 | ("R4", GREY_400),
285 | ("R5", GREY_500),
286 | ("R6", GREY_600),
287 | ("R7", GREY_700),
288 | ("R8", GREY_800),
289 | ("R9", GREY_900),
290 | ],
291 | &[
292 | ("S0", BLUE_GREY_50),
293 | ("S1", BLUE_GREY_100),
294 | ("S2", BLUE_GREY_200),
295 | ("S3", BLUE_GREY_300),
296 | ("S4", BLUE_GREY_400),
297 | ("S5", BLUE_GREY_500),
298 | ("S6", BLUE_GREY_600),
299 | ("S7", BLUE_GREY_700),
300 | ("S8", BLUE_GREY_800),
301 | ("S9", BLUE_GREY_900),
302 | ],
303 | ];
304 |
--------------------------------------------------------------------------------
/src/lib.rs:
--------------------------------------------------------------------------------
1 | //! # Material Design Colors
2 | //!
3 | //! This crate provides the 2014 Material Design System [color palettes] as constants.
4 | //!
5 | //! [color palettes]: https://m2.material.io/design/color/the-color-system.html#tools-for-picking-colors
6 | //!
7 | //! ## Installation
8 | //!
9 | //! ```bash
10 | //! cargo add material
11 | //! ```
12 | //!
13 | //! ## Usage
14 | //!
15 | //! ```rust
16 | //! use material::colors::*;
17 | //!
18 | //! assert_eq!(RED_50.to_string(), "#ffebee");
19 | //! assert_eq!(RED_100.to_string(), "#ffcdd2");
20 | //! ```
21 | //!
22 | //! ## Ratatui
23 | //!
24 | //! To use the colors with [Ratatui](https://ratatui.rs), enable the `ratatui` feature.
25 | //!
26 | //! ```bash
27 | //! cargo add material --features ratatui
28 | //! ```
29 | //!
30 | //! ```rust
31 | //! # #[cfg(feature = "ratatui")] {
32 | //! use material::colors::*;
33 | //! use ratatui::prelude::*;
34 | //!
35 | //! let line = Line::styled("hello world", Style::new().fg(RED_50.into()));
36 | //! # }
37 | //! ```
38 |
39 | use std::fmt::Display;
40 |
41 | #[cfg(feature = "ratatui")]
42 | use std::str::FromStr;
43 |
44 | #[cfg(feature = "ratatui")]
45 | use ratatui::style::Color;
46 |
47 | #[derive(Debug, Clone, Copy, PartialEq, Eq)]
48 | pub struct HexColor(&'static str);
49 |
50 | #[cfg(feature = "ratatui")]
51 | impl From for Color {
52 | /// Converts to a Ratatui Color from the HexColor.
53 | fn from(hex_color: HexColor) -> Self {
54 | Color::from_str(hex_color.0).unwrap()
55 | }
56 | }
57 |
58 | impl Display for HexColor {
59 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
60 | write!(f, "{}", self.0.to_string())
61 | }
62 | }
63 |
64 | pub mod colors {
65 | use crate::HexColor;
66 |
67 | /// ■ (#ffebee)
68 | pub const RED_50: HexColor = HexColor("#ffebee");
69 | /// ■ (#ffcdd2)
70 | pub const RED_100: HexColor = HexColor("#ffcdd2");
71 | /// ■ (#ef9a9a)
72 | pub const RED_200: HexColor = HexColor("#ef9a9a");
73 | /// ■ (#e57373)
74 | pub const RED_300: HexColor = HexColor("#e57373");
75 | /// ■ (#ef5350)
76 | pub const RED_400: HexColor = HexColor("#ef5350");
77 | /// ■ (#f44336)
78 | pub const RED_500: HexColor = HexColor("#f44336");
79 | /// ■ (#e53935)
80 | pub const RED_600: HexColor = HexColor("#e53935");
81 | /// ■ (#d32f2f)
82 | pub const RED_700: HexColor = HexColor("#d32f2f");
83 | /// ■ (#c62828)
84 | pub const RED_800: HexColor = HexColor("#c62828");
85 | /// ■ (#b71c1c)
86 | pub const RED_900: HexColor = HexColor("#b71c1c");
87 | /// ■ (#ff8a80)
88 | pub const RED_A100: HexColor = HexColor("#ff8a80");
89 | /// ■ (#ff5252)
90 | pub const RED_A200: HexColor = HexColor("#ff5252");
91 | /// ■ (#ff1744)
92 | pub const RED_A400: HexColor = HexColor("#ff1744");
93 | /// ■ (#d50000)
94 | pub const RED_A700: HexColor = HexColor("#d50000");
95 |
96 | /// ■ (#fce4ec)
97 | pub const PINK_50: HexColor = HexColor("#fce4ec");
98 | /// ■ (#f8bbd0)
99 | pub const PINK_100: HexColor = HexColor("#f8bbd0");
100 | /// ■ (#f48fb1)
101 | pub const PINK_200: HexColor = HexColor("#f48fb1");
102 | /// ■ (#f06292)
103 | pub const PINK_300: HexColor = HexColor("#f06292");
104 | /// ■ (#ec407a)
105 | pub const PINK_400: HexColor = HexColor("#ec407a");
106 | /// ■ (#e91e63)
107 | pub const PINK_500: HexColor = HexColor("#e91e63");
108 | /// ■ (#d81b60)
109 | pub const PINK_600: HexColor = HexColor("#d81b60");
110 | /// ■ (#c2185b)
111 | pub const PINK_700: HexColor = HexColor("#c2185b");
112 | /// ■ (#ad1457)
113 | pub const PINK_800: HexColor = HexColor("#ad1457");
114 | /// ■ (#880e4f)
115 | pub const PINK_900: HexColor = HexColor("#880e4f");
116 | /// ■ (#ff80ab)
117 | pub const PINK_A100: HexColor = HexColor("#ff80ab");
118 | /// ■ (#ff4081)
119 | pub const PINK_A200: HexColor = HexColor("#ff4081");
120 | /// ■ (#f50057)
121 | pub const PINK_A400: HexColor = HexColor("#f50057");
122 | /// ■ (#c51162)
123 | pub const PINK_A700: HexColor = HexColor("#c51162");
124 |
125 | /// ■ (#f3e5f5)
126 | pub const PURPLE_50: HexColor = HexColor("#f3e5f5");
127 | /// ■ (#e1bee7)
128 | pub const PURPLE_100: HexColor = HexColor("#e1bee7");
129 | /// ■ (#ce93d8)
130 | pub const PURPLE_200: HexColor = HexColor("#ce93d8");
131 | /// ■ (#ba68c8)
132 | pub const PURPLE_300: HexColor = HexColor("#ba68c8");
133 | /// ■ (#ab47bc)
134 | pub const PURPLE_400: HexColor = HexColor("#ab47bc");
135 | /// ■ (#9c27b0)
136 | pub const PURPLE_500: HexColor = HexColor("#9c27b0");
137 | /// ■ (#8e24aa)
138 | pub const PURPLE_600: HexColor = HexColor("#8e24aa");
139 | /// ■ (#7b1fa2)
140 | pub const PURPLE_700: HexColor = HexColor("#7b1fa2");
141 | /// ■ (#6a1b9a)
142 | pub const PURPLE_800: HexColor = HexColor("#6a1b9a");
143 | /// ■ (#4a148c)
144 | pub const PURPLE_900: HexColor = HexColor("#4a148c");
145 | /// ■ (#ea80fc)
146 | pub const PURPLE_A100: HexColor = HexColor("#ea80fc");
147 | /// ■ (#e040fb)
148 | pub const PURPLE_A200: HexColor = HexColor("#e040fb");
149 | /// ■ (#d500f9)
150 | pub const PURPLE_A400: HexColor = HexColor("#d500f9");
151 | /// ■ (#aa00ff)
152 | pub const PURPLE_A700: HexColor = HexColor("#aa00ff");
153 |
154 | /// ■ (#ede7f6)
155 | pub const DEEP_PURPLE_50: HexColor = HexColor("#ede7f6");
156 | /// ■ (#d1c4e9)
157 | pub const DEEP_PURPLE_100: HexColor = HexColor("#d1c4e9");
158 | /// ■ (#b39ddb)
159 | pub const DEEP_PURPLE_200: HexColor = HexColor("#b39ddb");
160 | /// ■ (#9575cd)
161 | pub const DEEP_PURPLE_300: HexColor = HexColor("#9575cd");
162 | /// ■ (#7e57c2)
163 | pub const DEEP_PURPLE_400: HexColor = HexColor("#7e57c2");
164 | /// ■ (#673ab7)
165 | pub const DEEP_PURPLE_500: HexColor = HexColor("#673ab7");
166 | /// ■ (#5e35b1)
167 | pub const DEEP_PURPLE_600: HexColor = HexColor("#5e35b1");
168 | /// ■ (#512da8)
169 | pub const DEEP_PURPLE_700: HexColor = HexColor("#512da8");
170 | /// ■ (#4527a0)
171 | pub const DEEP_PURPLE_800: HexColor = HexColor("#4527a0");
172 | /// ■ (#311b92)
173 | pub const DEEP_PURPLE_900: HexColor = HexColor("#311b92");
174 | /// ■ (#b388ff)
175 | pub const DEEP_PURPLE_A100: HexColor = HexColor("#b388ff");
176 | /// ■ (#7c4dff)
177 | pub const DEEP_PURPLE_A200: HexColor = HexColor("#7c4dff");
178 | /// ■ (#651fff)
179 | pub const DEEP_PURPLE_A400: HexColor = HexColor("#651fff");
180 | /// ■ (#6200ea)
181 | pub const DEEP_PURPLE_A700: HexColor = HexColor("#6200ea");
182 |
183 | /// ■ (#e8eaf6)
184 | pub const INDIGO_50: HexColor = HexColor("#e8eaf6");
185 | /// ■ (#c5cae9)
186 | pub const INDIGO_100: HexColor = HexColor("#c5cae9");
187 | /// ■ (#9fa8da)
188 | pub const INDIGO_200: HexColor = HexColor("#9fa8da");
189 | /// ■ (#7986cb)
190 | pub const INDIGO_300: HexColor = HexColor("#7986cb");
191 | /// ■ (#5c6bc0)
192 | pub const INDIGO_400: HexColor = HexColor("#5c6bc0");
193 | /// ■ (#3f51b5)
194 | pub const INDIGO_500: HexColor = HexColor("#3f51b5");
195 | /// ■ (#3949ab)
196 | pub const INDIGO_600: HexColor = HexColor("#3949ab");
197 | /// ■ (#303f9f)
198 | pub const INDIGO_700: HexColor = HexColor("#303f9f");
199 | /// ■ (#283593)
200 | pub const INDIGO_800: HexColor = HexColor("#283593");
201 | /// ■ (#1a237e)
202 | pub const INDIGO_900: HexColor = HexColor("#1a237e");
203 | /// ■ (#8c9eff)
204 | pub const INDIGO_A100: HexColor = HexColor("#8c9eff");
205 | /// ■ (#536dfe)
206 | pub const INDIGO_A200: HexColor = HexColor("#536dfe");
207 | /// ■ (#3d5afe)
208 | pub const INDIGO_A400: HexColor = HexColor("#3d5afe");
209 | /// ■ (#304ffe)
210 | pub const INDIGO_A700: HexColor = HexColor("#304ffe");
211 |
212 | /// ■ (#e3f2fd)
213 | pub const BLUE_50: HexColor = HexColor("#e3f2fd");
214 | /// ■ (#bbdefb)
215 | pub const BLUE_100: HexColor = HexColor("#bbdefb");
216 | /// ■ (#90caf9)
217 | pub const BLUE_200: HexColor = HexColor("#90caf9");
218 | /// ■ (#64b5f6)
219 | pub const BLUE_300: HexColor = HexColor("#64b5f6");
220 | /// ■ (#42a5f5)
221 | pub const BLUE_400: HexColor = HexColor("#42a5f5");
222 | /// ■ (#2196f3)
223 | pub const BLUE_500: HexColor = HexColor("#2196f3");
224 | /// ■ (#1e88e5)
225 | pub const BLUE_600: HexColor = HexColor("#1e88e5");
226 | /// ■ (#1976d2)
227 | pub const BLUE_700: HexColor = HexColor("#1976d2");
228 | /// ■ (#1565c0)
229 | pub const BLUE_800: HexColor = HexColor("#1565c0");
230 | /// ■ (#0d47a1)
231 | pub const BLUE_900: HexColor = HexColor("#0d47a1");
232 | /// ■ (#82b1ff)
233 | pub const BLUE_A100: HexColor = HexColor("#82b1ff");
234 | /// ■ (#448aff)
235 | pub const BLUE_A200: HexColor = HexColor("#448aff");
236 | /// ■ (#2979ff)
237 | pub const BLUE_A400: HexColor = HexColor("#2979ff");
238 | /// ■ (#2962ff)
239 | pub const BLUE_A700: HexColor = HexColor("#2962ff");
240 |
241 | /// ■ (#e1f5fe)
242 | pub const LIGHT_BLUE_50: HexColor = HexColor("#e1f5fe");
243 | /// ■ (#b3e5fc)
244 | pub const LIGHT_BLUE_100: HexColor = HexColor("#b3e5fc");
245 | /// ■ (#81d4fa)
246 | pub const LIGHT_BLUE_200: HexColor = HexColor("#81d4fa");
247 | /// ■ (#4fc3f7)
248 | pub const LIGHT_BLUE_300: HexColor = HexColor("#4fc3f7");
249 | /// ■ (#29b6f6)
250 | pub const LIGHT_BLUE_400: HexColor = HexColor("#29b6f6");
251 | /// ■ (#03a9f4)
252 | pub const LIGHT_BLUE_500: HexColor = HexColor("#03a9f4");
253 | /// ■ (#039be5)
254 | pub const LIGHT_BLUE_600: HexColor = HexColor("#039be5");
255 | /// ■ (#0288d1)
256 | pub const LIGHT_BLUE_700: HexColor = HexColor("#0288d1");
257 | /// ■ (#0277bd)
258 | pub const LIGHT_BLUE_800: HexColor = HexColor("#0277bd");
259 | /// ■ (#01579b)
260 | pub const LIGHT_BLUE_900: HexColor = HexColor("#01579b");
261 | /// ■ (#80d8ff)
262 | pub const LIGHT_BLUE_A100: HexColor = HexColor("#80d8ff");
263 | /// ■ (#40c4ff)
264 | pub const LIGHT_BLUE_A200: HexColor = HexColor("#40c4ff");
265 | /// ■ (#00b0ff)
266 | pub const LIGHT_BLUE_A400: HexColor = HexColor("#00b0ff");
267 | /// ■ (#0091ea)
268 | pub const LIGHT_BLUE_A700: HexColor = HexColor("#0091ea");
269 |
270 | /// ■ (#e0f7fa)
271 | pub const CYAN_50: HexColor = HexColor("#e0f7fa");
272 | /// ■ (#b2ebf2)
273 | pub const CYAN_100: HexColor = HexColor("#b2ebf2");
274 | /// ■ (#80deea)
275 | pub const CYAN_200: HexColor = HexColor("#80deea");
276 | /// ■ (#4dd0e1)
277 | pub const CYAN_300: HexColor = HexColor("#4dd0e1");
278 | /// ■ (#26c6da)
279 | pub const CYAN_400: HexColor = HexColor("#26c6da");
280 | /// ■ (#00bcd4)
281 | pub const CYAN_500: HexColor = HexColor("#00bcd4");
282 | /// ■ (#00acc1)
283 | pub const CYAN_600: HexColor = HexColor("#00acc1");
284 | /// ■ (#0097a7)
285 | pub const CYAN_700: HexColor = HexColor("#0097a7");
286 | /// ■ (#00838f)
287 | pub const CYAN_800: HexColor = HexColor("#00838f");
288 | /// ■ (#006064)
289 | pub const CYAN_900: HexColor = HexColor("#006064");
290 | /// ■ (#84ffff)
291 | pub const CYAN_A100: HexColor = HexColor("#84ffff");
292 | /// ■ (#18ffff)
293 | pub const CYAN_A200: HexColor = HexColor("#18ffff");
294 | /// ■ (#00e5ff)
295 | pub const CYAN_A400: HexColor = HexColor("#00e5ff");
296 | /// ■ (#00b8d4)
297 | pub const CYAN_A700: HexColor = HexColor("#00b8d4");
298 |
299 | /// ■ (#e0f2f1)
300 | pub const TEAL_50: HexColor = HexColor("#e0f2f1");
301 | /// ■ (#b2dfdb)
302 | pub const TEAL_100: HexColor = HexColor("#b2dfdb");
303 | /// ■ (#80cbc4)
304 | pub const TEAL_200: HexColor = HexColor("#80cbc4");
305 | /// ■ (#4db6ac)
306 | pub const TEAL_300: HexColor = HexColor("#4db6ac");
307 | /// ■ (#26a69a)
308 | pub const TEAL_400: HexColor = HexColor("#26a69a");
309 | /// ■ (#009688)
310 | pub const TEAL_500: HexColor = HexColor("#009688");
311 | /// ■ (#00897b)
312 | pub const TEAL_600: HexColor = HexColor("#00897b");
313 | /// ■ (#00796b)
314 | pub const TEAL_700: HexColor = HexColor("#00796b");
315 | /// ■ (#00695c)
316 | pub const TEAL_800: HexColor = HexColor("#00695c");
317 | /// ■ (#004d40)
318 | pub const TEAL_900: HexColor = HexColor("#004d40");
319 | /// ■ (#a7ffeb)
320 | pub const TEAL_A100: HexColor = HexColor("#a7ffeb");
321 | /// ■ (#64ffda)
322 | pub const TEAL_A200: HexColor = HexColor("#64ffda");
323 | /// ■ (#1de9b6)
324 | pub const TEAL_A400: HexColor = HexColor("#1de9b6");
325 | /// ■ (#00bfa5)
326 | pub const TEAL_A700: HexColor = HexColor("#00bfa5");
327 |
328 | /// ■ (#e8f5e9)
329 | pub const GREEN_50: HexColor = HexColor("#e8f5e9");
330 | /// ■ (#c8e6c9)
331 | pub const GREEN_100: HexColor = HexColor("#c8e6c9");
332 | /// ■ (#a5d6a7)
333 | pub const GREEN_200: HexColor = HexColor("#a5d6a7");
334 | /// ■ (#81c784)
335 | pub const GREEN_300: HexColor = HexColor("#81c784");
336 | /// ■ (#66bb6a)
337 | pub const GREEN_400: HexColor = HexColor("#66bb6a");
338 | /// ■ (#4caf50)
339 | pub const GREEN_500: HexColor = HexColor("#4caf50");
340 | /// ■ (#43a047)
341 | pub const GREEN_600: HexColor = HexColor("#43a047");
342 | /// ■ (#388e3c)
343 | pub const GREEN_700: HexColor = HexColor("#388e3c");
344 | /// ■ (#2e7d32)
345 | pub const GREEN_800: HexColor = HexColor("#2e7d32");
346 | /// ■ (#1b5e20)
347 | pub const GREEN_900: HexColor = HexColor("#1b5e20");
348 | /// ■ (#b9f6ca)
349 | pub const GREEN_A100: HexColor = HexColor("#b9f6ca");
350 | /// ■ (#69f0ae)
351 | pub const GREEN_A200: HexColor = HexColor("#69f0ae");
352 | /// ■ (#00e676)
353 | pub const GREEN_A400: HexColor = HexColor("#00e676");
354 | /// ■ (#00c853)
355 | pub const GREEN_A700: HexColor = HexColor("#00c853");
356 |
357 | /// ■ (#f1f8e9)
358 | pub const LIGHT_GREEN_50: HexColor = HexColor("#f1f8e9");
359 | /// ■ (#dcedc8)
360 | pub const LIGHT_GREEN_100: HexColor = HexColor("#dcedc8");
361 | /// ■ (#c5e1a5)
362 | pub const LIGHT_GREEN_200: HexColor = HexColor("#c5e1a5");
363 | /// ■ (#aed581)
364 | pub const LIGHT_GREEN_300: HexColor = HexColor("#aed581");
365 | /// ■ (#9ccc65)
366 | pub const LIGHT_GREEN_400: HexColor = HexColor("#9ccc65");
367 | /// ■ (#8bc34a)
368 | pub const LIGHT_GREEN_500: HexColor = HexColor("#8bc34a");
369 | /// ■ (#7cb342)
370 | pub const LIGHT_GREEN_600: HexColor = HexColor("#7cb342");
371 | /// ■ (#689f38)
372 | pub const LIGHT_GREEN_700: HexColor = HexColor("#689f38");
373 | /// ■ (#558b2f)
374 | pub const LIGHT_GREEN_800: HexColor = HexColor("#558b2f");
375 | /// ■ (#33691e)
376 | pub const LIGHT_GREEN_900: HexColor = HexColor("#33691e");
377 | /// ■ (#ccff90)
378 | pub const LIGHT_GREEN_A100: HexColor = HexColor("#ccff90");
379 | /// ■ (#b2ff59)
380 | pub const LIGHT_GREEN_A200: HexColor = HexColor("#b2ff59");
381 | /// ■ (#76ff03)
382 | pub const LIGHT_GREEN_A400: HexColor = HexColor("#76ff03");
383 | /// ■ (#64dd17)
384 | pub const LIGHT_GREEN_A700: HexColor = HexColor("#64dd17");
385 |
386 | /// ■ (#f9fbe7)
387 | pub const LIME_50: HexColor = HexColor("#f9fbe7");
388 | /// ■ (#f0f4c3)
389 | pub const LIME_100: HexColor = HexColor("#f0f4c3");
390 | /// ■ (#e6ee9c)
391 | pub const LIME_200: HexColor = HexColor("#e6ee9c");
392 | /// ■ (#dce775)
393 | pub const LIME_300: HexColor = HexColor("#dce775");
394 | /// ■ (#d4e157)
395 | pub const LIME_400: HexColor = HexColor("#d4e157");
396 | /// ■ (#cddc39)
397 | pub const LIME_500: HexColor = HexColor("#cddc39");
398 | /// ■ (#c0ca33)
399 | pub const LIME_600: HexColor = HexColor("#c0ca33");
400 | /// ■ (#afb42b)
401 | pub const LIME_700: HexColor = HexColor("#afb42b");
402 | /// ■ (#9e9d24)
403 | pub const LIME_800: HexColor = HexColor("#9e9d24");
404 | /// ■ (#827717)
405 | pub const LIME_900: HexColor = HexColor("#827717");
406 | /// ■ (#f4ff81)
407 | pub const LIME_A100: HexColor = HexColor("#f4ff81");
408 | /// ■ (#eeff41)
409 | pub const LIME_A200: HexColor = HexColor("#eeff41");
410 | /// ■ (#c6ff00)
411 | pub const LIME_A400: HexColor = HexColor("#c6ff00");
412 | /// ■ (#aeea00)
413 | pub const LIME_A700: HexColor = HexColor("#aeea00");
414 |
415 | /// ■ (#fffde7)
416 | pub const YELLOW_50: HexColor = HexColor("#fffde7");
417 | /// ■ (#fff9c4)
418 | pub const YELLOW_100: HexColor = HexColor("#fff9c4");
419 | /// ■ (#fff59d)
420 | pub const YELLOW_200: HexColor = HexColor("#fff59d");
421 | /// ■ (#fff176)
422 | pub const YELLOW_300: HexColor = HexColor("#fff176");
423 | /// ■ (#ffee58)
424 | pub const YELLOW_400: HexColor = HexColor("#ffee58");
425 | /// ■ (#ffeb3b)
426 | pub const YELLOW_500: HexColor = HexColor("#ffeb3b");
427 | /// ■ (#fdd835)
428 | pub const YELLOW_600: HexColor = HexColor("#fdd835");
429 | /// ■ (#fbc02d)
430 | pub const YELLOW_700: HexColor = HexColor("#fbc02d");
431 | /// ■ (#f9a825)
432 | pub const YELLOW_800: HexColor = HexColor("#f9a825");
433 | /// ■ (#f57f17)
434 | pub const YELLOW_900: HexColor = HexColor("#f57f17");
435 | /// ■ (#ffff8d)
436 | pub const YELLOW_A100: HexColor = HexColor("#ffff8d");
437 | /// ■ (#ffff00)
438 | pub const YELLOW_A200: HexColor = HexColor("#ffff00");
439 | /// ■ (#ffea00)
440 | pub const YELLOW_A400: HexColor = HexColor("#ffea00");
441 | /// ■ (#ffd600)
442 | pub const YELLOW_A700: HexColor = HexColor("#ffd600");
443 |
444 | /// ■ (#fff8e1)
445 | pub const AMBER_50: HexColor = HexColor("#fff8e1");
446 | /// ■ (#ffecb3)
447 | pub const AMBER_100: HexColor = HexColor("#ffecb3");
448 | /// ■ (#ffe082)
449 | pub const AMBER_200: HexColor = HexColor("#ffe082");
450 | /// ■ (#ffd54f)
451 | pub const AMBER_300: HexColor = HexColor("#ffd54f");
452 | /// ■ (#ffca28)
453 | pub const AMBER_400: HexColor = HexColor("#ffca28");
454 | /// ■ (#ffc107)
455 | pub const AMBER_500: HexColor = HexColor("#ffc107");
456 | /// ■ (#ffb300)
457 | pub const AMBER_600: HexColor = HexColor("#ffb300");
458 | /// ■ (#ffa000)
459 | pub const AMBER_700: HexColor = HexColor("#ffa000");
460 | /// ■ (#ff8f00)
461 | pub const AMBER_800: HexColor = HexColor("#ff8f00");
462 | /// ■ (#ff6f00)
463 | pub const AMBER_900: HexColor = HexColor("#ff6f00");
464 | /// ■ (#ffe57f)
465 | pub const AMBER_A100: HexColor = HexColor("#ffe57f");
466 | /// ■ (#ffd740)
467 | pub const AMBER_A200: HexColor = HexColor("#ffd740");
468 | /// ■ (#ffc400)
469 | pub const AMBER_A400: HexColor = HexColor("#ffc400");
470 | /// ■ (#ffab00)
471 | pub const AMBER_A700: HexColor = HexColor("#ffab00");
472 |
473 | /// ■ (#fff3e0)
474 | pub const ORANGE_50: HexColor = HexColor("#fff3e0");
475 | /// ■ (#ffe0b2)
476 | pub const ORANGE_100: HexColor = HexColor("#ffe0b2");
477 | /// ■ (#ffcc80)
478 | pub const ORANGE_200: HexColor = HexColor("#ffcc80");
479 | /// ■ (#ffb74d)
480 | pub const ORANGE_300: HexColor = HexColor("#ffb74d");
481 | /// ■ (#ffa726)
482 | pub const ORANGE_400: HexColor = HexColor("#ffa726");
483 | /// ■ (#ff9800)
484 | pub const ORANGE_500: HexColor = HexColor("#ff9800");
485 | /// ■ (#fb8c00)
486 | pub const ORANGE_600: HexColor = HexColor("#fb8c00");
487 | /// ■ (#f57c00)
488 | pub const ORANGE_700: HexColor = HexColor("#f57c00");
489 | /// ■ (#ef6c00)
490 | pub const ORANGE_800: HexColor = HexColor("#ef6c00");
491 | /// ■ (#e65100)
492 | pub const ORANGE_900: HexColor = HexColor("#e65100");
493 | /// ■ (#ffd180)
494 | pub const ORANGE_A100: HexColor = HexColor("#ffd180");
495 | /// ■ (#ffab40)
496 | pub const ORANGE_A200: HexColor = HexColor("#ffab40");
497 | /// ■ (#ff9100)
498 | pub const ORANGE_A400: HexColor = HexColor("#ff9100");
499 | /// ■ (#ff6d00)
500 | pub const ORANGE_A700: HexColor = HexColor("#ff6d00");
501 |
502 | /// ■ (#fbe9e7)
503 | pub const DEEP_ORANGE_50: HexColor = HexColor("#fbe9e7");
504 | /// ■ (#ffccbc)
505 | pub const DEEP_ORANGE_100: HexColor = HexColor("#ffccbc");
506 | /// ■ (#ffab91)
507 | pub const DEEP_ORANGE_200: HexColor = HexColor("#ffab91");
508 | /// ■ (#ff8a65)
509 | pub const DEEP_ORANGE_300: HexColor = HexColor("#ff8a65");
510 | /// ■ (#ff7043)
511 | pub const DEEP_ORANGE_400: HexColor = HexColor("#ff7043");
512 | /// ■ (#ff5722)
513 | pub const DEEP_ORANGE_500: HexColor = HexColor("#ff5722");
514 | /// ■ (#f4511e)
515 | pub const DEEP_ORANGE_600: HexColor = HexColor("#f4511e");
516 | /// ■ (#e64a19)
517 | pub const DEEP_ORANGE_700: HexColor = HexColor("#e64a19");
518 | /// ■ (#d84315)
519 | pub const DEEP_ORANGE_800: HexColor = HexColor("#d84315");
520 | /// ■ (#bf360c)
521 | pub const DEEP_ORANGE_900: HexColor = HexColor("#bf360c");
522 | /// ■ (#ff9e80)
523 | pub const DEEP_ORANGE_A100: HexColor = HexColor("#ff9e80");
524 | /// ■ (#ff6e40)
525 | pub const DEEP_ORANGE_A200: HexColor = HexColor("#ff6e40");
526 | /// ■ (#ff3d00)
527 | pub const DEEP_ORANGE_A400: HexColor = HexColor("#ff3d00");
528 | /// ■ (#dd2c00)
529 | pub const DEEP_ORANGE_A700: HexColor = HexColor("#dd2c00");
530 |
531 | /// ■ (#efebe9)
532 | pub const BROWN_50: HexColor = HexColor("#efebe9");
533 | /// ■ (#d7ccc8)
534 | pub const BROWN_100: HexColor = HexColor("#d7ccc8");
535 | /// ■ (#bcaaa4)
536 | pub const BROWN_200: HexColor = HexColor("#bcaaa4");
537 | /// ■ (#a1887f)
538 | pub const BROWN_300: HexColor = HexColor("#a1887f");
539 | /// ■ (#8d6e63)
540 | pub const BROWN_400: HexColor = HexColor("#8d6e63");
541 | /// ■ (#795548)
542 | pub const BROWN_500: HexColor = HexColor("#795548");
543 | /// ■ (#6d4c41)
544 | pub const BROWN_600: HexColor = HexColor("#6d4c41");
545 | /// ■ (#5d4037)
546 | pub const BROWN_700: HexColor = HexColor("#5d4037");
547 | /// ■ (#4e342e)
548 | pub const BROWN_800: HexColor = HexColor("#4e342e");
549 | /// ■ (#3e2723)
550 | pub const BROWN_900: HexColor = HexColor("#3e2723");
551 |
552 | /// ■ (#fafafa)
553 | pub const GREY_50: HexColor = HexColor("#fafafa");
554 | /// ■ (#f5f5f5)
555 | pub const GREY_100: HexColor = HexColor("#f5f5f5");
556 | /// ■ (#eeeeee)
557 | pub const GREY_200: HexColor = HexColor("#eeeeee");
558 | /// ■ (#e0e0e0)
559 | pub const GREY_300: HexColor = HexColor("#e0e0e0");
560 | /// ■ (#bdbdbd)
561 | pub const GREY_400: HexColor = HexColor("#bdbdbd");
562 | /// ■ (#9e9e9e)
563 | pub const GREY_500: HexColor = HexColor("#9e9e9e");
564 | /// ■ (#757575)
565 | pub const GREY_600: HexColor = HexColor("#757575");
566 | /// ■ (#616161)
567 | pub const GREY_700: HexColor = HexColor("#616161");
568 | /// ■ (#424242)
569 | pub const GREY_800: HexColor = HexColor("#424242");
570 | /// ■ (#212121)
571 | pub const GREY_900: HexColor = HexColor("#212121");
572 |
573 | /// ■ (#eceff1)
574 | pub const BLUE_GREY_50: HexColor = HexColor("#eceff1");
575 | /// ■ (#cfd8dc)
576 | pub const BLUE_GREY_100: HexColor = HexColor("#cfd8dc");
577 | /// ■ (#b0bec5)
578 | pub const BLUE_GREY_200: HexColor = HexColor("#b0bec5");
579 | /// ■ (#90a4ae)
580 | pub const BLUE_GREY_300: HexColor = HexColor("#90a4ae");
581 | /// ■ (#78909c)
582 | pub const BLUE_GREY_400: HexColor = HexColor("#78909c");
583 | /// ■ (#607d8b)
584 | pub const BLUE_GREY_500: HexColor = HexColor("#607d8b");
585 | /// ■ (#546e7a)
586 | pub const BLUE_GREY_600: HexColor = HexColor("#546e7a");
587 | /// ■ (#455a64)
588 | pub const BLUE_GREY_700: HexColor = HexColor("#455a64");
589 | /// ■ (#37474f)
590 | pub const BLUE_GREY_800: HexColor = HexColor("#37474f");
591 | /// ■ (#263238)
592 | pub const BLUE_GREY_900: HexColor = HexColor("#263238");
593 |
594 | /// ■ (#000000)
595 | pub const BLACK: HexColor = HexColor("#000000");
596 | /// ■ (#ffffff)
597 | pub const WHITE: HexColor = HexColor("#ffffff");
598 | }
599 |
600 | #[cfg(test)]
601 | mod tests {}
602 |
--------------------------------------------------------------------------------
/src/main.rs:
--------------------------------------------------------------------------------
1 | mod app;
2 | mod color_data;
3 | mod ui;
4 |
5 | use app::App;
6 | use ui::ui;
7 |
8 | use crossterm::{
9 | event::{read as read_event, Event, KeyCode},
10 | execute,
11 | terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
12 | };
13 | use ratatui::{
14 | backend::{Backend, CrosstermBackend},
15 | Terminal,
16 | };
17 | use std::{error::Error, io};
18 |
19 | fn main() -> Result<(), Box> {
20 | // setup terminal
21 | enable_raw_mode()?;
22 | let mut stdout = io::stdout();
23 | execute!(stdout, EnterAlternateScreen)?;
24 | let backend = CrosstermBackend::new(stdout);
25 | let mut terminal = Terminal::new(backend)?;
26 |
27 | let res = run_app(&mut terminal);
28 |
29 | // restore terminal
30 | disable_raw_mode()?;
31 | execute!(terminal.backend_mut(), LeaveAlternateScreen)?;
32 |
33 | if let Err(err) = res {
34 | println!("{:?}", err);
35 | }
36 |
37 | Ok(())
38 | }
39 |
40 | fn run_app(terminal: &mut Terminal) -> io::Result<()> {
41 | let mut app = App::new();
42 |
43 | loop {
44 | terminal.draw(|f| ui(f, &app))?;
45 |
46 | if let Event::Key(key) = read_event()? {
47 | match key.code {
48 | KeyCode::Esc => {
49 | return Ok(());
50 | }
51 | KeyCode::Backspace => app.delete_input(),
52 | KeyCode::Char(c) => app.handle_input(c),
53 | _ => {}
54 | }
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/ui.rs:
--------------------------------------------------------------------------------
1 | use crate::app::App;
2 | use crate::color_data::{N_COLORS, N_VARIANTS};
3 | use ratatui::{
4 | layout::{Alignment, Rect},
5 | style::{Color, Style},
6 | widgets::{Block, BorderType, Borders},
7 | Frame,
8 | };
9 |
10 | pub fn ui(f: &mut Frame, app: &App) {
11 | let sq_height = (f.size().height - 5) / (N_VARIANTS as u16);
12 | let sq_width = f.size().width / (N_COLORS as u16);
13 |
14 | // Place left & top centered starting positions
15 | let left = (f.size().width - (N_COLORS as u16 * sq_width)) / 2;
16 | let top = (f.size().height - (N_VARIANTS as u16 * sq_height + 2)) / 2;
17 |
18 | let mut pos = (left, top);
19 |
20 | for color in app.colors {
21 | pos.1 = top;
22 | for (i, color_var) in color.iter().enumerate() {
23 | let bg_color = color_var.1.into();
24 | let text_color = if i < 5 || i > 9 {
25 | Color::Black
26 | } else {
27 | Color::White
28 | };
29 | f.render_widget(
30 | Block::default()
31 | .style(Style::default().bg(bg_color).fg(text_color))
32 | .title(color_var.0)
33 | .title_alignment(Alignment::Center),
34 | Rect::new(pos.0, pos.1, sq_width, sq_height),
35 | );
36 | pos.1 += sq_height;
37 | }
38 | pos.0 += sq_width;
39 | }
40 |
41 | // last colors are missing 4 variants
42 | pos.1 += sq_height * 4;
43 |
44 | f.render_widget(
45 | Block::default()
46 | .borders(Borders::ALL)
47 | .border_type(BorderType::Rounded)
48 | .title("Type the color code to copy. Press Esc to exit.")
49 | .title_alignment(Alignment::Center),
50 | Rect::new(left, pos.1, sq_width * N_COLORS as u16, sq_height + 3),
51 | );
52 |
53 | f.render_widget(
54 | Block::default()
55 | .title(String::from(&app.input.to_uppercase()))
56 | .title_alignment(Alignment::Center),
57 | Rect::new(left, pos.1 + 1, sq_width * N_COLORS as u16, sq_height),
58 | );
59 |
60 | f.render_widget(
61 | Block::default()
62 | .title(String::from(&app.message))
63 | .title_alignment(Alignment::Center),
64 | Rect::new(left, pos.1 + 2, sq_width * N_COLORS as u16, sq_height),
65 | );
66 | }
67 |
--------------------------------------------------------------------------------