From 6d23fdf4f1c60595e90b0e898a02da70bf020579 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 7 Mar 2023 15:18:36 +0000 Subject: [PATCH] Ensure the toggle button keeps any bold state (#1965) * Ensure the toggle button keeps any bold state Fixes #1963. * Update snapshots --- src/textual/widgets/_toggle_button.py | 2 +- .../__snapshots__/test_snapshots.ambr | 368 +++++++++--------- 2 files changed, 185 insertions(+), 185 deletions(-) diff --git a/src/textual/widgets/_toggle_button.py b/src/textual/widgets/_toggle_button.py index 0a3cfdc62c..51efa137bc 100644 --- a/src/textual/widgets/_toggle_button.py +++ b/src/textual/widgets/_toggle_button.py @@ -158,7 +158,7 @@ def _button(self) -> Text: # If the button is off, we're going to do a bit of a switcharound to # make it look like it's a "cutout". if not self.value: - button_style = Style.from_color( + button_style += Style.from_color( self.background_colors[1].rich_color, button_style.bgcolor ) diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr index 4c6089d71a..ba2cbf1ca1 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr +++ b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr @@ -530,140 +530,140 @@ font-weight: 700; } - .terminal-2698519028-matrix { + .terminal-2118990000-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2698519028-title { + .terminal-2118990000-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2698519028-r1 { fill: #e1e1e1 } - .terminal-2698519028-r2 { fill: #c5c8c6 } - .terminal-2698519028-r3 { fill: #004578 } - .terminal-2698519028-r4 { fill: #42464b } - .terminal-2698519028-r5 { fill: #24292f } - .terminal-2698519028-r6 { fill: #e2e3e3 } - .terminal-2698519028-r7 { fill: #e2e3e3;font-weight: bold } - .terminal-2698519028-r8 { fill: #98729f } - .terminal-2698519028-r9 { fill: #4ebf71;font-weight: bold } - .terminal-2698519028-r10 { fill: #565a5e } - .terminal-2698519028-r11 { fill: #e2e3e3;text-decoration: underline; } + .terminal-2118990000-r1 { fill: #e1e1e1 } + .terminal-2118990000-r2 { fill: #c5c8c6 } + .terminal-2118990000-r3 { fill: #004578 } + .terminal-2118990000-r4 { fill: #42464b } + .terminal-2118990000-r5 { fill: #24292f;font-weight: bold } + .terminal-2118990000-r6 { fill: #e2e3e3 } + .terminal-2118990000-r7 { fill: #e2e3e3;font-weight: bold } + .terminal-2118990000-r8 { fill: #98729f } + .terminal-2118990000-r9 { fill: #4ebf71;font-weight: bold } + .terminal-2118990000-r10 { fill: #565a5e } + .terminal-2118990000-r11 { fill: #e2e3e3;text-decoration: underline; } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - CheckboxApp + CheckboxApp - + - - - - - - - ─────────────────── - - - XArrakis 😓 - XCaladan - XChusuk - XGiedi Prime - XGinaz - XGrumman - XKaitain - XNovebruns - - - ─────────────────── - - - - + + + + + + + ─────────────────── + + + XArrakis 😓 + XCaladan + XChusuk + XGiedi Prime + XGinaz + XGrumman + XKaitain + XNovebruns + + + ─────────────────── + + + + @@ -15472,137 +15472,137 @@ font-weight: 700; } - .terminal-2270305171-matrix { + .terminal-1209678307-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2270305171-title { + .terminal-1209678307-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2270305171-r1 { fill: #e1e1e1 } - .terminal-2270305171-r2 { fill: #c5c8c6 } - .terminal-2270305171-r3 { fill: #666666 } - .terminal-2270305171-r4 { fill: #3d3d3d } - .terminal-2270305171-r5 { fill: #1e1e1e } - .terminal-2270305171-r6 { fill: #515151 } - .terminal-2270305171-r7 { fill: #e1e1e1;text-decoration: underline; } - .terminal-2270305171-r8 { fill: #4ebf71;font-weight: bold } + .terminal-1209678307-r1 { fill: #e1e1e1 } + .terminal-1209678307-r2 { fill: #c5c8c6 } + .terminal-1209678307-r3 { fill: #666666 } + .terminal-1209678307-r4 { fill: #3d3d3d } + .terminal-1209678307-r5 { fill: #1e1e1e;font-weight: bold } + .terminal-1209678307-r6 { fill: #515151 } + .terminal-1209678307-r7 { fill: #e1e1e1;text-decoration: underline; } + .terminal-1209678307-r8 { fill: #4ebf71;font-weight: bold } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - RadioChoicesApp + RadioChoicesApp - + - - - - - - - - ─────────────────────────────────────── - Battlestar Galactica - Dune 1984 - Dune 2021 - Serenity - Star Trek: The Motion Picture - Star Wars: A New Hope - The Last Starfighter - Total Recall 👉 🔴 - Wing Commander - ─────────────────────────────────────── - - - - - - + + + + + + + + ─────────────────────────────────────── + Battlestar Galactica + Dune 1984 + Dune 2021 + Serenity + Star Trek: The Motion Picture + Star Wars: A New Hope + The Last Starfighter + Total Recall 👉 🔴 + Wing Commander + ─────────────────────────────────────── + + + + + + @@ -15633,138 +15633,138 @@ font-weight: 700; } - .terminal-1873544496-matrix { + .terminal-4238820762-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-1873544496-title { + .terminal-4238820762-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-1873544496-r1 { fill: #e1e1e1 } - .terminal-1873544496-r2 { fill: #c5c8c6 } - .terminal-1873544496-r3 { fill: #666666 } - .terminal-1873544496-r4 { fill: #3d3d3d } - .terminal-1873544496-r5 { fill: #1e1e1e } - .terminal-1873544496-r6 { fill: #4ebf71;font-weight: bold } - .terminal-1873544496-r7 { fill: #cc555a;font-weight: bold;font-style: italic; } - .terminal-1873544496-r8 { fill: #515151 } - .terminal-1873544496-r9 { fill: #e1e1e1;text-decoration: underline; } + .terminal-4238820762-r1 { fill: #e1e1e1 } + .terminal-4238820762-r2 { fill: #c5c8c6 } + .terminal-4238820762-r3 { fill: #666666 } + .terminal-4238820762-r4 { fill: #3d3d3d } + .terminal-4238820762-r5 { fill: #1e1e1e;font-weight: bold } + .terminal-4238820762-r6 { fill: #4ebf71;font-weight: bold } + .terminal-4238820762-r7 { fill: #cc555a;font-weight: bold;font-style: italic; } + .terminal-4238820762-r8 { fill: #515151 } + .terminal-4238820762-r9 { fill: #e1e1e1;text-decoration: underline; } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - RadioChoicesApp + RadioChoicesApp - + - - - - - - - - ────────────────────────────────────────────────────────────────────── - Battlestar GalacticaAmanda - Dune 1984Connor MacLeod - Dune 2021Duncan MacLeod - SerenityHeather MacLeod - Star Trek: The Motion PictureJoe Dawson - Star Wars: A New HopeKurgan, The - The Last StarfighterMethos - Total Recall 👉 🔴Rachel Ellenstein - Wing CommanderRamírez - ────────────────────────────────────────────────────────────────────── - - - - - - + + + + + + + + ────────────────────────────────────────────────────────────────────── + Battlestar GalacticaAmanda + Dune 1984Connor MacLeod + Dune 2021Duncan MacLeod + SerenityHeather MacLeod + Star Trek: The Motion PictureJoe Dawson + Star Wars: A New HopeKurgan, The + The Last StarfighterMethos + Total Recall 👉 🔴Rachel Ellenstein + Wing CommanderRamírez + ────────────────────────────────────────────────────────────────────── + + + + + +