mirror of
https://github.com/1j01/textual-paint.git
synced 2025-01-02 20:04:36 +03:00
Let buttons fall back to the original color when deselected
This commit is contained in:
parent
3f8a652fe2
commit
b64869eae4
@ -26,6 +26,10 @@ Screen {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#tools_box Button.selected {
|
||||
background: #aaa;
|
||||
}
|
||||
|
||||
Button {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
5
paint.py
5
paint.py
@ -115,9 +115,8 @@ class PaintApp(App):
|
||||
|
||||
def watch_selected_tool(self, old_selected_tool: Tool, selected_tool: Tool) -> None:
|
||||
"""Called when selected_tool changes."""
|
||||
# TODO: revert to default color defined by built-in style
|
||||
self.query_one("#tool_button_" + old_selected_tool.name).styles.background = "#555"
|
||||
self.query_one("#tool_button_" + selected_tool.name).styles.background = "#aaa"
|
||||
self.query_one("#tool_button_" + old_selected_tool.name).classes = "tool_button"
|
||||
self.query_one("#tool_button_" + selected_tool.name).classes = "tool_button selected"
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
"""Add our widgets."""
|
||||
|
Loading…
Reference in New Issue
Block a user