forked from 1b-agent/opencadstudio-upstream
Select Color: Phosphor eyedropper icon; load button and page arrows in active-tab colours
- The pipette is Phosphor Icons' "eyedropper" (regular, MIT); its licence is in assets/icons/ui/LICENSE-phosphor.txt and the SVG header. - The load-book button and the page strip's up/down arrows use the active tab's colours (background.strong and its text colour), slightly darker on hover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
This commit is contained in:
3 files changed
+40
-8
No files matched your search
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Phosphor Icons
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -1 +1,2 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#B4B6B9" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M14.5 6.5l3 3"/><path d="M13 5l2.6-2.6a2.1 2.1 0 0 1 3 0l3 3a2.1 2.1 0 0 1 0 3L19 11"/><path d="M13 5l6 6"/><path d="M16 8L6.5 17.5 4 18l.5-2.5L14 6"/><path d="M4 18l-1.5 1.5"/></svg>
|
<!-- Phosphor Icons "eyedropper" (regular), MIT License, Copyright (c) 2023 Phosphor Icons, https://github.com/phosphor-icons/core. See LICENSE-phosphor.txt. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="#B4B6B9"><path d="M224,67.3a35.79,35.79,0,0,0-11.26-25.66c-14-13.28-36.72-12.78-50.62,1.13L142.8,62.2a24,24,0,0,0-33.14.77l-9,9a16,16,0,0,0,0,22.64l2,2.06-51,51a39.75,39.75,0,0,0-10.53,38l-8,18.41A13.68,13.68,0,0,0,36,219.3a15.92,15.92,0,0,0,17.71,3.35L71.23,215a39.89,39.89,0,0,0,37.06-10.75l51-51,2.06,2.06a16,16,0,0,0,22.62,0l9-9a24,24,0,0,0,.74-33.18l19.75-19.87A35.75,35.75,0,0,0,224,67.3ZM97,193a24,24,0,0,1-24,6,8,8,0,0,0-5.55.31l-18.1,7.91L57,189.41a8,8,0,0,0,.25-5.75A23.88,23.88,0,0,1,63,159l51-51,33.94,34ZM202.13,82l-25.37,25.52a8,8,0,0,0,0,11.3l4.89,4.89a8,8,0,0,1,0,11.32l-9,9L112,83.26l9-9a8,8,0,0,1,11.31,0l4.89,4.89a8,8,0,0,0,11.33,0l24.94-25.09c7.81-7.82,20.5-8.18,28.29-.81a20,20,0,0,1,.39,28.7Z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 348 B After Width: | Height: | Size: 954 B |
@@ -730,7 +730,7 @@ impl ColorPicker {
|
|||||||
let load_button = |content: Element<'static, Message>| {
|
let load_button = |content: Element<'static, Message>| {
|
||||||
button(content)
|
button(content)
|
||||||
.on_press(picker_msg(ColorPickerMsg::LoadBook))
|
.on_press(picker_msg(ColorPickerMsg::LoadBook))
|
||||||
.style(button::secondary)
|
.style(tab_button_style)
|
||||||
};
|
};
|
||||||
let Some(book) = self.books.get(self.book) else {
|
let Some(book) = self.books.get(self.book) else {
|
||||||
return container(
|
return container(
|
||||||
@@ -761,7 +761,7 @@ impl ColorPicker {
|
|||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
load_button(
|
load_button(
|
||||||
container(
|
container(
|
||||||
secondary_icon(crate::ui::icons::themed_handle(
|
tab_icon(crate::ui::icons::themed_handle(
|
||||||
crate::ui::icons::FOLDER_OPEN
|
crate::ui::icons::FOLDER_OPEN
|
||||||
))
|
))
|
||||||
.width(16)
|
.width(16)
|
||||||
@@ -854,14 +854,14 @@ impl ColorPicker {
|
|||||||
.width(9)
|
.width(9)
|
||||||
.height(5)
|
.height(5)
|
||||||
.style(|theme: &Theme, _status| svg::Style {
|
.style(|theme: &Theme, _status| svg::Style {
|
||||||
color: Some(theme.palette().secondary.base.text),
|
color: Some(theme.palette().background.strong.text),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.on_press(picker_msg(ColorPickerMsg::BookPage(page)))
|
.on_press(picker_msg(ColorPickerMsg::BookPage(page)))
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.height(18)
|
.height(18)
|
||||||
.padding([6, 8])
|
.padding([6, 8])
|
||||||
.style(button::secondary)
|
.style(tab_button_style)
|
||||||
};
|
};
|
||||||
let strip = column![
|
let strip = column![
|
||||||
arrow("M0 4L3.5 0L7 4z", self.book_page.saturating_sub(1)),
|
arrow("M0 4L3.5 0L7 4z", self.book_page.saturating_sub(1)),
|
||||||
@@ -1139,10 +1139,20 @@ fn search_box<'a>(
|
|||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An icon in the text colour of a secondary button, so it reads on it.
|
/// A small button in the colours of the active tab: the load button and
|
||||||
fn secondary_icon<'a>(handle: svg::Handle) -> svg::Svg<'a> {
|
/// the page arrows.
|
||||||
|
fn tab_button_style(theme: &Theme, status: button::Status) -> button::Style {
|
||||||
|
let mut style = segment_style(theme, true, status);
|
||||||
|
if matches!(status, button::Status::Hovered | button::Status::Pressed) {
|
||||||
|
style.background = Some(theme.palette().background.stronger.color.into());
|
||||||
|
}
|
||||||
|
style
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An icon in the active tab's text colour, for `tab_button_style`.
|
||||||
|
fn tab_icon<'a>(handle: svg::Handle) -> svg::Svg<'a> {
|
||||||
svg(handle).style(|theme: &Theme, _status| svg::Style {
|
svg(handle).style(|theme: &Theme, _status| svg::Style {
|
||||||
color: Some(theme.palette().secondary.base.text),
|
color: Some(theme.palette().background.strong.text),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user