Select Color: built-in RAL CLASSIC and CSS COLORS color books

Two AutoCAD .acb books ship with the panel and are read the first time it
opens in a session; a loaded book of the same name replaces them. RAL
values are approximate (CC BY-SA 4.0, Wikipedia); sources and licences
are in each file's header and assets/color_books/README.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
This commit is contained in:
Claude committed 2026-10-13 08:36:21 +00:00
1 parent 60dc633db1
commit 00b925b9fa
5 files changed
+543 -8

No files matched your search

+11
View File
@@ -57,6 +57,17 @@ impl ColorBook {
}
}
/// The colour books that ship with the program; their licences are in the
/// files' header comments.
pub fn builtin() -> impl Iterator<Item = ColorBook> {
[
include_str!("../../../assets/color_books/ral-classic.acb"),
include_str!("../../../assets/color_books/css-colors.acb"),
]
.into_iter()
.filter_map(|text| parse(text).ok())
}
/// Read an `.acb` file's text.
pub fn parse(text: &str) -> Result<ColorBook, String> {
let doc = roxmltree::Document::parse(text.trim_start_matches('\u{feff}'))