feat(options): command line text colour and a fonts folder

Display gets a command line text colour (blank keeps the theme's); it
covers history, prompts and the input, while errors stay red. Files
lists the fonts folder that text resolution searches, so .shx files can
be added by hand; opening it creates it first.

Discussions #1493, #1372

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-07 08:50:12 +03:00
1 parent 1c37c90c75
commit 7a8ec02003
29 files changed
+144 -15

No files matched your search

+7
View File
@@ -592,6 +592,10 @@ pub(super) struct OpenCADStudio {
crosshair_color_input: String,
/// Explicit object-snap marker colour; `None` keeps the automatic one.
snap_marker_color: Option<[u8; 3]>,
/// Explicit command-line text colour; `None` keeps the theme's.
command_text_color: Option<[u8; 3]>,
/// Editable Options buffer for the command-line text colour.
command_text_color_input: String,
/// Editable Options buffer for the snap marker colour.
snap_marker_color_input: String,
/// Defer the ISOLINES mesh rebuild until the slider is released.
@@ -2296,6 +2300,7 @@ pub enum Message {
/// Edit the optional crosshair RGB value; blank restores automatic contrast.
CrosshairColorChanged(String),
SnapMarkerColorChanged(String),
CommandTextColorChanged(String),
/// Options → Files: the default template for new drawings.
QnewTemplateChanged(String),
QnewTemplateBrowse,
@@ -4167,6 +4172,8 @@ impl OpenCADStudio {
crosshair_color_input: String::new(),
snap_marker_color: None,
snap_marker_color_input: String::new(),
command_text_color: None,
command_text_color_input: String::new(),
isolines_awaiting_regen: false,
snap_angle_input: "0".to_string(),
lineweight_display_scale: 100,
+3
View File
@@ -432,6 +432,8 @@ pub struct UserSettings {
pub crosshair_color: Option<[u8; 3]>,
/// Explicit object-snap marker RGB. `None` keeps the automatic colour.
pub snap_marker_color: Option<[u8; 3]>,
/// Explicit command-line text RGB. `None` keeps the theme's.
pub command_text_color: Option<[u8; 3]>,
/// Model-space lineweight preview scale as a percentage.
pub lineweight_display_scale: i32,
/// Isometric drafting changes the grid and crosshair to the active axis
@@ -825,6 +827,7 @@ impl Default for UserSettings {
cursor_type: CursorType::Crosshair,
crosshair_color: None,
snap_marker_color: None,
command_text_color: None,
lineweight_display_scale: 100,
isometric_drafting: false,
iso_plane: IsoPlane::Left,
+7
View File
@@ -682,6 +682,7 @@ impl OpenCADStudio {
cursor_type: self.cursor_type,
crosshair_color: self.crosshair_color,
snap_marker_color: self.snap_marker_color,
command_text_color: self.command_text_color,
lineweight_display_scale: self.lineweight_display_scale,
isometric_drafting: self.isometric_drafting,
iso_plane: self.iso_plane,
@@ -798,6 +799,12 @@ impl OpenCADStudio {
.snap_marker_color
.map(crate::app::config::rgb_to_hex)
.unwrap_or_default();
self.command_text_color = s.command_text_color;
self.command_text_color_input = s
.command_text_color
.map(crate::app::config::rgb_to_hex)
.unwrap_or_default();
crate::ui::command_line::set_text_color(s.command_text_color);
self.lineweight_display_scale = s.lineweight_display_scale.clamp(25, 200);
self.isometric_drafting = s.isometric_drafting;
self.iso_plane = s.iso_plane;
+19 -1
View File
@@ -8060,6 +8060,20 @@ impl OpenCADStudio {
None => Message::Noop,
},
),
Message::CommandTextColorChanged(value) => {
self.command_text_color_input = value.clone();
let color = if value.trim().is_empty() {
None
} else if let Some(rgb) = crate::app::config::parse_hex(&value) {
Some(rgb)
} else {
return Task::none();
};
self.command_text_color = color;
crate::ui::command_line::set_text_color(color);
self.persist_settings_if_changed();
Task::none()
}
Message::SnapMarkerColorChanged(value) => {
self.snap_marker_color_input = value.clone();
if value.trim().is_empty() {
@@ -8532,7 +8546,11 @@ impl OpenCADStudio {
Task::none()
}
Message::OpenFolder(path) => crate::sys::open_url(&path, None),
Message::OpenFolder(path) => {
// The fonts folder exists only once something is put in it.
let _ = std::fs::create_dir_all(&path);
crate::sys::open_url(&path, None)
}
Message::PickDragRectToggled(rectangle) => {
self.pick_drag_rect = rectangle;
+4
View File
@@ -376,6 +376,8 @@ impl OpenCADStudio {
.map(|p| p.display().to_string()),
autosave: crate::config::config_dir()
.map(|_| std::env::temp_dir().display().to_string()),
fonts: crate::io::font_repo::fonts_dir()
.map(|p| p.display().to_string()),
}
}
#[cfg(target_arch = "wasm32")]
@@ -391,6 +393,8 @@ impl OpenCADStudio {
&self.crosshair_color_input,
self.snap_marker_color,
&self.snap_marker_color_input,
self.command_text_color,
&self.command_text_color_input,
self.lineweight_display_scale,
&self.model_space,
&self.model_bg_input,