Add tab group color command
This commit is contained in:
@@ -11,8 +11,8 @@ use crate::{
|
||||
move_tab_space_name, new_private_profile_name, new_profile_name, new_space_name, note_body,
|
||||
notes_url, plugin_detail_url, plugins_url, reading_list_url, reading_progress_percent,
|
||||
rename_tab_group_name, search_url, settings_page_url, settings_url, shortcut_settings_url,
|
||||
space_icon, split_group_name, switch_profile_name, sync_status_url, tab_group_name,
|
||||
tab_note_body, task_manager_url,
|
||||
space_icon, split_group_name, switch_profile_name, sync_status_url, tab_group_color_hex,
|
||||
tab_group_name, tab_note_body, task_manager_url,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -149,6 +149,9 @@ impl BrowserCore {
|
||||
if let Some(name) = rename_tab_group_name(command) {
|
||||
return Ok(self.rename_active_tab_group(name)?.is_some());
|
||||
}
|
||||
if let Some(color_hex) = tab_group_color_hex(command) {
|
||||
return Ok(self.set_active_tab_group_color(color_hex)?.is_some());
|
||||
}
|
||||
if let Some(body) = tab_note_body(command) {
|
||||
self.save_active_tab_note(body)?;
|
||||
return Ok(true);
|
||||
|
||||
@@ -100,6 +100,24 @@ impl BrowserCore {
|
||||
group.rename(name).map_err(CoreError::from)
|
||||
}
|
||||
|
||||
pub fn set_active_tab_group_color(&mut self, color_hex: u32) -> Result<Option<()>, CoreError> {
|
||||
let Some(group_id) = self.active_tab_group_id()? else {
|
||||
return Ok(None);
|
||||
};
|
||||
self.set_tab_group_color(&group_id, color_hex)?;
|
||||
Ok(Some(()))
|
||||
}
|
||||
|
||||
pub fn set_tab_group_color(
|
||||
&mut self,
|
||||
group_id: &TabGroupId,
|
||||
color_hex: u32,
|
||||
) -> Result<(), CoreError> {
|
||||
let group = self.tab_group_mut(group_id)?;
|
||||
group.set_color_hex(color_hex);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn discard_active_tab_group(&mut self) -> Result<Option<usize>, CoreError> {
|
||||
let Some(group_id) = self.active_tab_group_id()? else {
|
||||
return Ok(None);
|
||||
|
||||
Reference in New Issue
Block a user