mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-23 02:04:21 +01:00
profile: add about and username to profile previews
Also adjust colors to match design Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -2,7 +2,7 @@ use egui::Color32;
|
||||
|
||||
pub const PURPLE: Color32 = Color32::from_rgb(0xCC, 0x43, 0xC5);
|
||||
//pub const DARK_BG: Color32 = egui::Color32::from_rgb(40, 44, 52);
|
||||
const GRAY_SECONDARY: Color32 = Color32::from_rgb(0x8A, 0x8A, 0x8A);
|
||||
pub const GRAY_SECONDARY: Color32 = Color32::from_rgb(0x8A, 0x8A, 0x8A);
|
||||
const BLACK: Color32 = Color32::from_rgb(0x00, 0x00, 0x00);
|
||||
const RED_700: Color32 = Color32::from_rgb(0xC7, 0x37, 0x5A);
|
||||
const GREEN_700: Color32 = Color32::from_rgb(0x24, 0xEC, 0xC9);
|
||||
@@ -16,7 +16,7 @@ const DARK_ISH_BG: Color32 = Color32::from_rgb(0x22, 0x22, 0x22);
|
||||
const SEMI_DARK_BG: Color32 = Color32::from_rgb(0x44, 0x44, 0x44);
|
||||
|
||||
const LIGHT_GRAY: Color32 = Color32::from_rgb(0xc8, 0xc8, 0xc8); // 78%
|
||||
const MID_GRAY: Color32 = Color32::from_rgb(0xba, 0xba, 0xba); // 72%
|
||||
pub const MID_GRAY: Color32 = Color32::from_rgb(0xbd, 0xbd, 0xbd);
|
||||
const DARKER_GRAY: Color32 = Color32::from_rgb(0xa5, 0xa5, 0xa5); // 65%
|
||||
const EVEN_DARKER_GRAY: Color32 = Color32::from_rgb(0x89, 0x89, 0x89); // 54%
|
||||
|
||||
@@ -93,11 +93,11 @@ pub fn light_color_theme() -> ColorTheme {
|
||||
selection_color: GREEN_700,
|
||||
|
||||
// WINDOW
|
||||
window_fill: MID_GRAY,
|
||||
window_fill: Color32::WHITE,
|
||||
window_stroke_color: DARKER_GRAY,
|
||||
|
||||
// NONINTERACTIVE WIDGET
|
||||
noninteractive_bg_fill: MID_GRAY,
|
||||
noninteractive_bg_fill: Color32::WHITE,
|
||||
noninteractive_weak_bg_fill: EVEN_DARKER_GRAY,
|
||||
noninteractive_bg_stroke_color: DARKER_GRAY,
|
||||
noninteractive_fg_stroke_color: GRAY_SECONDARY,
|
||||
|
||||
@@ -4,8 +4,8 @@ pub mod options;
|
||||
pub use contents::NoteContents;
|
||||
pub use options::NoteOptions;
|
||||
|
||||
use crate::{ui, Damus};
|
||||
use egui::{Color32, Label, RichText, Sense, TextureHandle, Vec2};
|
||||
use crate::{colors, ui, Damus};
|
||||
use egui::{Label, RichText, Sense, TextureHandle, Vec2};
|
||||
|
||||
pub struct Note<'a> {
|
||||
app: &'a mut Damus,
|
||||
@@ -237,17 +237,20 @@ fn render_reltime(
|
||||
puffin::profile_function!();
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
let color = Color32::from_rgb(0x8A, 0x8A, 0x8A);
|
||||
if before {
|
||||
ui.add(Label::new(RichText::new("⋅").size(10.0).color(color)));
|
||||
ui.add(Label::new(
|
||||
RichText::new("⋅").size(10.0).color(colors::GRAY_SECONDARY),
|
||||
));
|
||||
}
|
||||
ui.add(Label::new(
|
||||
RichText::new(note_cache.reltime_str())
|
||||
.size(10.0)
|
||||
.color(color),
|
||||
.color(colors::GRAY_SECONDARY),
|
||||
));
|
||||
if !before {
|
||||
ui.add(Label::new(RichText::new("⋅").size(10.0).color(color)));
|
||||
ui.add(Label::new(
|
||||
RichText::new("⋅").size(10.0).color(colors::GRAY_SECONDARY),
|
||||
));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use crate::app_style::NotedeckTextStyle;
|
||||
use crate::images;
|
||||
use crate::DisplayName;
|
||||
use crate::{colors, images, DisplayName};
|
||||
use egui::load::TexturePoll;
|
||||
use egui::{RichText, Sense};
|
||||
use egui_extras::Size;
|
||||
@@ -66,22 +65,33 @@ impl<'a> ProfilePreview<'a> {
|
||||
DisplayName::One("??")
|
||||
};
|
||||
|
||||
match name {
|
||||
DisplayName::One(n) => {
|
||||
ui.label(RichText::new(n).text_style(NotedeckTextStyle::Heading3.text_style()));
|
||||
crate::ui::padding(12.0, ui, |ui| {
|
||||
match name {
|
||||
DisplayName::One(n) => {
|
||||
ui.label(RichText::new(n).text_style(NotedeckTextStyle::Heading3.text_style()));
|
||||
}
|
||||
|
||||
DisplayName::Both {
|
||||
display_name,
|
||||
username,
|
||||
} => {
|
||||
ui.label(
|
||||
RichText::new(display_name)
|
||||
.text_style(NotedeckTextStyle::Heading3.text_style()),
|
||||
);
|
||||
|
||||
ui.label(
|
||||
RichText::new(format!("@{}", username))
|
||||
.size(12.0)
|
||||
.color(colors::MID_GRAY),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
DisplayName::Both {
|
||||
display_name,
|
||||
username,
|
||||
} => {
|
||||
ui.label(
|
||||
RichText::new(display_name)
|
||||
.text_style(NotedeckTextStyle::Heading3.text_style()),
|
||||
);
|
||||
ui.label(RichText::new(format!("@{}", username)));
|
||||
if let Some(about) = profile.record().profile().and_then(|p| p.about()) {
|
||||
ui.label(about);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user