wip custom theme
[?]
May 16, 2025, 10:30 AM
MYGIBRRHHXPKVRAMQQRJTZH74L2XOK3SF7J57JPCRKSVRLZ2D6NQCDependencies
- [2]
WT3GA27Padd cursor with selection - [3]
NWJD6VM6mv libflowers libflorescence - [4]
GWZGYNIBadd view crate - [5]
23SFYK4Qbig view refactor into a new crate - [6]
OPXFZKEBview tests setup - [7]
YBJRDOTCmake all repo actions async - [8]
B4RMW5AEadd syntax highlighter to untracked files contents - [9]
AMPZ2BXKshow changed files diffs (only Edit atm) - [10]
AXSXZQDGfix updating changed file contents, styling - [11]
SWWE2R6Mdisplay basic repo stuff - [12]
Y5ATDI2Hconvert changed file diffs and load src only if any needs it - [13]
6YZAVBWUInitial commit - [14]
JE44NYHMdisplay log files diffs
Change contents
- edit in inflorescence_view/src/util.rs at line 2
use crate::Theme; - replacement in inflorescence_view/src/util.rs at line 7
pub fn el<'a, E, M>(e: E) -> Element<'a, M>pub fn el<'a, E, M>(e: E) -> Element<'a, M, Theme> - replacement in inflorescence_view/src/util.rs at line 9
E: Into<Element<'a, M>>,E: Into<Element<'a, M, Theme>>, - replacement in inflorescence_view/src/util.rs at line 11
Into::<Element<M>>::into(e)Into::<Element<M, Theme>>::into(e) - file addition: theme.rs[4.85]
use libflorescence::prelude::*;use iced::{advanced::widget::text,border, color,theme::{self, palette},widget::{button, container,scrollable::{self, Rail},text_editor,},window, Background, Border, Color,};const DARK_BLUE: Color = color!(0x010032);const TEAL: Color = color!(0x3b8588);const MAGENTA: Color = color!(0xe933f6);const TURQOISE: Color = color!(0x75fad1);// TODO not sure if I'll use this?const PALETTE: theme::Palette = theme::Palette {background: DARK_BLUE,text: scale_rgb(TEAL, 1.),primary: TURQOISE,success: TURQOISE,warning: MAGENTA,danger: MAGENTA,};#[derive(Debug, Default)]pub struct Theme;#[derive(Debug, Clone, Copy)]pub enum Button {Normal,Selected,}pub fn theme<S>(_state: &S, _window_id: window::Id) -> Theme {Theme}impl theme::Base for Theme {fn base(&self) -> theme::Style {theme::Style {background_color: PALETTE.background,text_color: PALETTE.text,}}fn palette(&self) -> Option<theme::Palette> {Some(PALETTE)}}impl button::Catalog for Theme {type Class<'a> = Button;fn default<'a>() -> Self::Class<'a> {Button::Normal}fn style(&self,class: &Self::Class<'_>,status: button::Status,) -> button::Style {let primary = palette::Primary::generate(PALETTE.primary,PALETTE.background,PALETTE.text,);let base = button::Style {background: Some(Background::Color(primary.base.color)),text_color: primary.base.text,border: border::rounded(2),..button::Style::default()};let base = match status {button::Status::Active | button::Status::Pressed => base,button::Status::Hovered => button::Style {background: Some(Background::Color(primary.strong.color)),..base},button::Status::Disabled => button::Style {background: base.background.map(|background| background.scale_alpha(0.5)),text_color: base.text_color.scale_alpha(0.5),..base},};match class {Button::Normal => button::Style {border: Border {color: Color::TRANSPARENT,width: 1.0,..default()},..base},Button::Selected => button::Style {background: Some(Background::Color(MAGENTA)),border: Border {color: Color::WHITE,width: 1.0,..default()},..base},}}}impl container::Catalog for Theme {type Class<'a> = ();fn default<'a>() -> Self::Class<'a> {()}fn style(&self, class: &Self::Class<'_>) -> container::Style {container::Style::default()}}impl scrollable::Catalog for Theme {type Class<'a> = ();fn default<'a>() -> Self::Class<'a> {()}fn style(&self,class: &Self::Class<'_>,status: scrollable::Status,) -> scrollable::Style {let background =palette::Background::new(PALETTE.background, PALETTE.text);// TODO not same as defaultlet scrollbar = Rail {background: Some(background.weak.color.into()),border: border::rounded(2),scroller: scrollable::Scroller {color: background.strong.color,border: border::rounded(2),},};scrollable::Style {container: container::Style::default(),vertical_rail: scrollbar,horizontal_rail: scrollbar,gap: None,}}}impl text::Catalog for Theme {type Class<'a> = ();fn default<'a>() -> Self::Class<'a> {()}fn style(&self, item: &Self::Class<'_>) -> text::Style {text::Style { color: None }}}impl text_editor::Catalog for Theme {type Class<'a> = ();fn default<'a>() -> Self::Class<'a> {()}fn style(&self,class: &Self::Class<'_>,status: text_editor::Status,) -> text_editor::Style {// TODO not same as defaultlet background =palette::Background::new(PALETTE.background, PALETTE.text);let primary = palette::Primary::generate(PALETTE.primary,PALETTE.background,PALETTE.text,);let active = text_editor::Style {background: Background::Color(background.base.color),border: Border {radius: 2.0.into(),width: 1.0,color: background.strong.color,},icon: background.weak.text,placeholder: background.strong.color,value: background.base.text,selection: primary.weak.color,};active}}// pub fn theme<S>(_state: &S, _window_id: window::Id) -> Theme {// let text = scale_rgb(TEAL, 2.);// Theme::custom(// "Inflorescence".to_string(),// theme::Palette {// background: DARK_BLUE,// text,// primary: MAGENTA,// success: TURQOISE,// warning: MAGENTA,// danger: MAGENTA,// },// )// }const fn scale_rgb(color: Color, scale: f32) -> Color {let Color { r, g, b, a } = color;Color {r: r * scale,g: g * scale,b: b * scale,a,}} - replacement in inflorescence_view/src/testing.rs at line 1
use iced::{window, Element, Theme};use crate::Theme;use iced::{window, Element}; - replacement in inflorescence_view/src/testing.rs at line 53
let mut sim =Simulator::with_size(iced::Settings::default(), size, element);let mut sim = Simulator::<_, Theme, _>::with_size(iced::Settings::default(),size,element,); - edit in inflorescence_view/src/lib.rs at line 4
pub mod theme; - edit in inflorescence_view/src/lib.rs at line 7
pub use theme::{theme, Theme}; - edit in inflorescence_view/src/lib.rs at line 9[5.329]→[6.4149:4177](∅→∅),[6.4177]→[5.329:415](∅→∅),[5.329]→[5.329:415](∅→∅),[5.415]→[4.295:297](∅→∅),[4.295]→[4.295:297](∅→∅)
use iced::{window, Theme};pub fn theme<S>(_state: &S, _window_id: window::Id) -> Theme {Theme::TokyoNight} - replacement in inflorescence_view/src/diff.rs at line 6
use crate::el;use crate::{el, Theme}; - replacement in inflorescence_view/src/diff.rs at line 122
pub fn view<'a>(state: Option<&'a State>, file: &'a File) -> Element<'a, Msg> {pub fn view<'a>(state: Option<&'a State>,file: &'a File,) -> Element<'a, Msg, Theme> { - replacement in inflorescence_view/src/diff.rs at line 141
) -> Element<'a, Msg> {) -> Element<'a, Msg, Theme> { - replacement in inflorescence_view/src/diff.rs at line 209
) -> Element<'a, Msg> {) -> Element<'a, Msg, Theme> { - replacement in inflorescence_view/src/diff.rs at line 228
fn view_diff_with_contents(diff: &DiffWithContents) -> Element<'_, Msg> {fn view_diff_with_contents(diff: &DiffWithContents) -> Element<'_, Msg, Theme> { - replacement in inflorescence_view/src/diff.rs at line 296
fn view_diff_without_contents(diff: &DiffWithoutContents) -> Element<'_, Msg> {fn view_diff_without_contents(diff: &DiffWithoutContents,) -> Element<'_, Msg, Theme> { - replacement in inflorescence_view/src/diff.rs at line 353
fn mono_text<'a>(txt: impl text::IntoFragment<'a>) -> iced::widget::Text<'a> {fn mono_text<'a>(txt: impl text::IntoFragment<'a>,) -> iced::widget::Text<'a, Theme> { - replacement in inflorescence_view/src/diff.rs at line 362
fn line_num_view<'a>(num: usize, digits: usize) -> iced::widget::Text<'a> {fn line_num_view<'a>(num: usize,digits: usize,) -> iced::widget::Text<'a, Theme> { - replacement in inflorescence_view/src/diff.rs at line 370
.style(move |theme| {let palette = theme.extended_palette();text::Style {color: Some(palette.background.base.text.scale_alpha(0.61)),}})// TODO replace with class// .style(move |theme| {// let palette = theme.extended_palette();// text::Style {// color: Some(palette.background.base.text.scale_alpha(0.61)),// }// }) - replacement in inflorescence_view/src/diff.rs at line 392
) -> Element<'a, Msg> {) -> Element<'a, Msg, Theme> { - replacement in inflorescence_view/src/diff.rs at line 405
LineKind::Added => line.style(|_theme| {container::background(Background::from(ADDED_BG_COLOR))}),LineKind::Deleted => line.style(|_theme| {container::background(Background::from(DELETED_BG_COLOR))}),LineKind::Added => line,// TODO replace with class// .style(|_theme| {// container::background(Background::from(ADDED_BG_COLOR))// })LineKind::Deleted => line, // TODO replace with class// .style(|_theme| {// container::background(Background::from(DELETED_BG_COLOR))// }) - replacement in inflorescence_view/src/app.rs at line 6
use crate::{diff, el};use crate::{diff, el, theme, Theme}; - replacement in inflorescence_view/src/app.rs at line 9
use iced::{font, window, Border, Color, Element, Font, Length, Theme};use iced::{font, window, Border, Color, Element, Font, Length}; - replacement in inflorescence_view/src/app.rs at line 150
) -> Element<'a, Msg>) -> Element<'a, Msg, Theme> - replacement in inflorescence_view/src/app.rs at line 175
.style(selectable_button_style(is_selected)),.class(selectable_button_class(is_selected)), - replacement in inflorescence_view/src/app.rs at line 193
.style(selectable_button_style(is_selected)),.class(selectable_button_class(is_selected)), - replacement in inflorescence_view/src/app.rs at line 215
.style(selectable_button_style(is_selected))),.class(selectable_button_class(is_selected))), - replacement in inflorescence_view/src/app.rs at line 308
}).style(selectable_button_style(is_selected)))}).class(selectable_button_class(is_selected))) - replacement in inflorescence_view/src/app.rs at line 371
fn view_diff_header(header: String) -> Element<'static, Msg> {fn view_diff_header(header: String) -> Element<'static, Msg, Theme> { - replacement in inflorescence_view/src/app.rs at line 378
fn selectable_button_style(is_selected: bool,) -> impl Fn(&Theme, button::Status) -> button::Style {move |theme, status| -> button::Style {button::Style {border: Border {color: if is_selected {Color::WHITE} else {Color::TRANSPARENT},width: 1.0,..default()},..button::Catalog::style(theme,&<Theme as button::Catalog>::default(),status,)}fn selectable_button_class(is_selected: bool) -> theme::Button {if is_selected {theme::Button::Selected} else {theme::Button::Normal - edit in inflorescence_view/src/app/test.rs at line 106
let state = State {repo_path: &repo_path,repo: repo.as_ref(),cursor: &cursor,record_msg: record_msg.as_ref(),diffs_state: &diffs_state,};test_view(&mut results,uniq_name,view(state, window_id, |_id| Some(&diff)),size,);// _________________________________________________________________________//let uniq_name = "app_loaded_selected_untracked";let cursor = cursor::State {selection: Some(cursor::Selection::UntrackedFile {ix: 1,path: "".to_string(),}),}; - replacement in inflorescence/src/main.rs at line 12
use inflorescence_view::{app, theme};use inflorescence_view::{app, theme, Theme}; - replacement in inflorescence/src/main.rs at line 623
fn view(state: &State, window_id: window::Id) -> Element<Msg> {fn view(state: &State, window_id: window::Id) -> Element<Msg, Theme> {