Skip to content

Commit

Permalink
Fix Solid nickname color
Browse files Browse the repository at this point in the history
This was accidentally changed to the action color in squidowl#232.
  • Loading branch information
neilalexander committed Mar 15, 2024
1 parent 8378f04 commit 9b38cf9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/theme/text.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use super::Theme;
use data::theme::{alpha, randomize_color};
use iced::widget::text::{Appearance, DefaultStyle};

use super::Theme;

impl DefaultStyle for Theme {
fn default_style(&self) -> Appearance {
none(self)
Expand Down Expand Up @@ -49,14 +50,23 @@ pub fn transparent(theme: &Theme) -> Appearance {
}

pub fn nickname(theme: &Theme, seed: Option<String>, transparent: bool) -> Appearance {
let dark_theme = theme.colors().is_dark_theme();

if seed.is_none() {
let mut color = theme.colors().text.base;
if transparent {
color = alpha(color, if dark_theme { 0.2 } else { 0.4 })
}
return Appearance { color: Some(color) };
}

let original_color = theme.colors().action.base;
let randomized_color = seed
.as_deref()
.map(|seed| randomize_color(original_color, seed))
.unwrap_or_else(|| original_color);

let color = if transparent {
let dark_theme = theme.colors().is_dark_theme();
alpha(randomized_color, if dark_theme { 0.2 } else { 0.4 })
} else {
randomized_color
Expand Down

0 comments on commit 9b38cf9

Please sign in to comment.