diff --git a/README.md b/README.md index 40550fb0..83bfb753 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ All configuration is done either at the config file in `XDG_CONFIG_DIR/.config/s 1, 2, 3, …, 9, 0 — select nth color from the color palette +If out of range select custom color NEXTRELEASE + #### Tool Selection Shortcuts (configurable) 0.20.0 Default single-key shortcuts: - p: Pointer tool diff --git a/src/main.rs b/src/main.rs index 114c599a..6c9df4ea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -257,11 +257,15 @@ impl Component for App { .emit(ToolsToolbarInput::SwitchSelectedTool(tool)); } AppInput::ColorSwitchShortcut(index) => { + let palette_len = APP_CONFIG.read().color_palette().palette().len() as u64; + let color_button = if index < palette_len { + ui::toolbars::ColorButtons::Palette(index) + } else { + ui::toolbars::ColorButtons::Custom + }; self.style_toolbar .sender() - .emit(StyleToolbarInput::ColorButtonSelected( - ui::toolbars::ColorButtons::Palette(index), - )); + .emit(StyleToolbarInput::ColorButtonSelected(color_button)); } AppInput::ScaleFactorChanged => { self.sketch_board diff --git a/src/sketch_board.rs b/src/sketch_board.rs index 22a828fc..bbada02b 100644 --- a/src/sketch_board.rs +++ b/src/sketch_board.rs @@ -895,13 +895,9 @@ impl SketchBoard { } else { hotkey_digit - 1 }; - if APP_CONFIG.read().color_palette().palette().len() - >= (index_digit + 1) as usize - { - sender - .output_sender() - .emit(SketchBoardOutput::ColorSwitchShortcut(index_digit as u64)); - } + sender + .output_sender() + .emit(SketchBoardOutput::ColorSwitchShortcut(index_digit as u64)); } } TextEventMsg::Preedit {