refactor(core): remove provider module, migrate to LLMProvider, add client mode handling, improve serialization error handling, update workspace edition, and clean up conditionals and imports
This commit is contained in:
@@ -586,16 +586,16 @@ where
|
||||
}
|
||||
|
||||
fn parse_color(s: &str) -> Result<Color, String> {
|
||||
if let Some(hex) = s.strip_prefix('#') {
|
||||
if hex.len() == 6 {
|
||||
let r = u8::from_str_radix(&hex[0..2], 16)
|
||||
.map_err(|_| format!("Invalid hex color: {}", s))?;
|
||||
let g = u8::from_str_radix(&hex[2..4], 16)
|
||||
.map_err(|_| format!("Invalid hex color: {}", s))?;
|
||||
let b = u8::from_str_radix(&hex[4..6], 16)
|
||||
.map_err(|_| format!("Invalid hex color: {}", s))?;
|
||||
return Ok(Color::Rgb(r, g, b));
|
||||
}
|
||||
if let Some(hex) = s.strip_prefix('#')
|
||||
&& hex.len() == 6
|
||||
{
|
||||
let r =
|
||||
u8::from_str_radix(&hex[0..2], 16).map_err(|_| format!("Invalid hex color: {}", s))?;
|
||||
let g =
|
||||
u8::from_str_radix(&hex[2..4], 16).map_err(|_| format!("Invalid hex color: {}", s))?;
|
||||
let b =
|
||||
u8::from_str_radix(&hex[4..6], 16).map_err(|_| format!("Invalid hex color: {}", s))?;
|
||||
return Ok(Color::Rgb(r, g, b));
|
||||
}
|
||||
|
||||
// Try named colors
|
||||
|
||||
Reference in New Issue
Block a user