aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/display/wayland_theme.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2021-12-03 06:50:14 +0300
committerGitHub <noreply@github.com>2021-12-03 03:50:14 +0000
commit4c6a763850a5dec0fa34d15e356dcba19875690a (patch)
treed32af54c261a97525410ae6c98527debc51885e9 /alacritty/src/display/wayland_theme.rs
parent8681f71084894db6d1e258be17db1f80bb669314 (diff)
downloadr-alacritty-4c6a763850a5dec0fa34d15e356dcba19875690a.tar.gz
r-alacritty-4c6a763850a5dec0fa34d15e356dcba19875690a.tar.bz2
r-alacritty-4c6a763850a5dec0fa34d15e356dcba19875690a.zip
Bump glutin to 0.28.0
Fixes #5603. Fixes #5422. Fixes #5350. Fixes #4105. Co-authored-by: Christian Duerr <contact@christianduerr.com>
Diffstat (limited to 'alacritty/src/display/wayland_theme.rs')
-rw-r--r--alacritty/src/display/wayland_theme.rs81
1 files changed, 0 insertions, 81 deletions
diff --git a/alacritty/src/display/wayland_theme.rs b/alacritty/src/display/wayland_theme.rs
deleted file mode 100644
index b56ad0c7..00000000
--- a/alacritty/src/display/wayland_theme.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-use glutin::platform::unix::{ARGBColor, Button, ButtonState, Element, Theme as WaylandTheme};
-
-use alacritty_terminal::term::color::Rgb;
-
-use crate::config::color::Colors;
-
-const INACTIVE_OPACITY: u8 = 127;
-
-#[derive(Debug, Clone)]
-pub struct AlacrittyWaylandTheme {
- pub foreground: ARGBColor,
- pub background: ARGBColor,
- pub dim_foreground: ARGBColor,
- pub hovered_close_icon: ARGBColor,
- pub hovered_maximize_icon: ARGBColor,
- pub hovered_minimize_icon: ARGBColor,
-}
-
-impl AlacrittyWaylandTheme {
- pub fn new(colors: &Colors) -> Self {
- let hovered_close_icon = colors.normal.red.into_rgba();
- let hovered_maximize_icon = colors.normal.green.into_rgba();
- let hovered_minimize_icon = colors.normal.yellow.into_rgba();
- let foreground = colors.search_bar_foreground().into_rgba();
- let background = colors.search_bar_background().into_rgba();
-
- let mut dim_foreground = foreground;
- dim_foreground.a = INACTIVE_OPACITY;
-
- Self {
- foreground,
- background,
- dim_foreground,
- hovered_close_icon,
- hovered_maximize_icon,
- hovered_minimize_icon,
- }
- }
-}
-
-impl WaylandTheme for AlacrittyWaylandTheme {
- fn element_color(&self, element: Element, window_active: bool) -> ARGBColor {
- match element {
- Element::Bar | Element::Separator => self.background,
- Element::Text if window_active => self.foreground,
- Element::Text => self.dim_foreground,
- }
- }
-
- fn button_color(
- &self,
- button: Button,
- state: ButtonState,
- foreground: bool,
- window_active: bool,
- ) -> ARGBColor {
- if !foreground {
- return ARGBColor { a: 0, r: 0, g: 0, b: 0 };
- } else if !window_active {
- return self.dim_foreground;
- }
-
- match (state, button) {
- (ButtonState::Idle, _) => self.foreground,
- (ButtonState::Disabled, _) => self.dim_foreground,
- (_, Button::Minimize) => self.hovered_minimize_icon,
- (_, Button::Maximize) => self.hovered_maximize_icon,
- (_, Button::Close) => self.hovered_close_icon,
- }
- }
-}
-
-trait IntoArgbColor {
- fn into_rgba(self) -> ARGBColor;
-}
-
-impl IntoArgbColor for Rgb {
- fn into_rgba(self) -> ARGBColor {
- ARGBColor { a: 0xff, r: self.r, g: self.g, b: self.b }
- }
-}