image: Use const for RGBA::new
This commit is contained in:
parent
88a617d99e
commit
41c26daba2
2 changed files with 11 additions and 12 deletions
|
|
@ -60,17 +60,16 @@ use crate::util::Gesture;
|
||||||
|
|
||||||
/// Default background color around images and behind transparent images
|
/// Default background color around images and behind transparent images
|
||||||
/// `#242424`
|
/// `#242424`
|
||||||
static BACKGROUND_COLOR_DEFAULT: Lazy<gdk::RGBA> =
|
const BACKGROUND_COLOR_DEFAULT: gdk::RGBA = gdk::RGBA::new(36. / 255., 36. / 255., 36. / 255., 1.);
|
||||||
Lazy::new(|| gdk::RGBA::new(36. / 255., 36. / 255., 36. / 255., 1.));
|
|
||||||
/// Background color if the default does not give enough contrast for
|
/// Background color if the default does not give enough contrast for
|
||||||
/// transparent images `#e8e7e6`
|
/// transparent images `#e8e7e6`
|
||||||
static BACKGROUND_COLOR_ALTERNATE: Lazy<gdk::RGBA> =
|
const BACKGROUND_COLOR_ALTERNATE: gdk::RGBA =
|
||||||
Lazy::new(|| gdk::RGBA::new(232. / 255., 231. / 255., 230. / 255., 1.));
|
gdk::RGBA::new(232. / 255., 231. / 255., 230. / 255., 1.);
|
||||||
|
|
||||||
static BACKGROUND_COLOR_DEFAULT_LIGHT_MODE: Lazy<gdk::RGBA> =
|
const BACKGROUND_COLOR_DEFAULT_LIGHT_MODE: gdk::RGBA =
|
||||||
Lazy::new(|| gdk::RGBA::new(250. / 255., 250. / 255., 250. / 255., 1.));
|
gdk::RGBA::new(250. / 255., 250. / 255., 250. / 255., 1.);
|
||||||
static BACKGROUND_COLOR_ALTERNATE_LIGHT_MODE: Lazy<gdk::RGBA> =
|
const BACKGROUND_COLOR_ALTERNATE_LIGHT_MODE: gdk::RGBA =
|
||||||
Lazy::new(|| gdk::RGBA::new(103. / 255., 101. / 255., 110. / 255., 1.));
|
gdk::RGBA::new(103. / 255., 101. / 255., 110. / 255., 1.);
|
||||||
|
|
||||||
/// Consider 3.5:1 contrast and worse to be bad contrast for a pixel
|
/// Consider 3.5:1 contrast and worse to be bad contrast for a pixel
|
||||||
static BACKGROUND_GUESS_LOW_CONTRAST_RATIO: f32 = 3.5;
|
static BACKGROUND_GUESS_LOW_CONTRAST_RATIO: f32 = 3.5;
|
||||||
|
|
|
||||||
|
|
@ -35,17 +35,17 @@ impl imp::LpImage {
|
||||||
|
|
||||||
pub fn default_background_color() -> gdk::RGBA {
|
pub fn default_background_color() -> gdk::RGBA {
|
||||||
if adw::StyleManager::default().is_dark() {
|
if adw::StyleManager::default().is_dark() {
|
||||||
*BACKGROUND_COLOR_DEFAULT
|
BACKGROUND_COLOR_DEFAULT
|
||||||
} else {
|
} else {
|
||||||
*BACKGROUND_COLOR_DEFAULT_LIGHT_MODE
|
BACKGROUND_COLOR_DEFAULT_LIGHT_MODE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alternate_background_color() -> gdk::RGBA {
|
pub fn alternate_background_color() -> gdk::RGBA {
|
||||||
if adw::StyleManager::default().is_dark() {
|
if adw::StyleManager::default().is_dark() {
|
||||||
*BACKGROUND_COLOR_ALTERNATE
|
BACKGROUND_COLOR_ALTERNATE
|
||||||
} else {
|
} else {
|
||||||
*BACKGROUND_COLOR_ALTERNATE_LIGHT_MODE
|
BACKGROUND_COLOR_ALTERNATE_LIGHT_MODE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue