-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from StarterX4/sweet-theme
"Sweet" Widget Scheme
- Loading branch information
Showing
11 changed files
with
274 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use fltk::{enums::*, prelude::*, *}; | ||
use fltk_theme::widget_schemes::sweet::frames::*; | ||
use fltk_theme::{SchemeType, WidgetScheme}; | ||
|
||
use fltk_theme::colors::sweet::dark::*; // get all the dark sweet colors | ||
|
||
// use fltk_theme::colors::sweet::light::*; // get all the light sweet colors | ||
|
||
fn main() { | ||
let a = app::App::default(); | ||
app::set_font_size(12); | ||
let bg = windowBackgroundColor.to_rgb(); | ||
app::background(bg.0, bg.1, bg.2); | ||
let ctrl = controlAccentColor.to_rgb(); | ||
app::background2(ctrl.0, ctrl.1, ctrl.2); | ||
let lbl = labelColor.to_rgb(); | ||
app::foreground(lbl.0, lbl.1, lbl.2); | ||
let txt_sel_bg = selectedTextBackgroundColor.to_rgb(); | ||
app::set_selection_color(txt_sel_bg.0, txt_sel_bg.1, txt_sel_bg.2); | ||
//app::set_color(Color::Selection, 255, 255, 255); | ||
let widget_scheme = WidgetScheme::new(SchemeType::Sweet); | ||
widget_scheme.apply(); | ||
let mut win = window::Window::default() | ||
.with_size(400, 300) | ||
.with_label("Sweet Dark"); | ||
let mut col = group::Flex::default() | ||
.with_size(340, 240) | ||
.center_of_parent() | ||
.column(); | ||
col.set_frame(FrameType::NoBox); | ||
col.set_margins(100, 40, 100, 40); | ||
let mut choice = menu::Choice::default(); | ||
choice.set_color(*controlColor); | ||
choice.add_choice("Opt1|Opt2|Opt3"); | ||
choice.set_value(2); | ||
let mut inp = input::Input::default(); | ||
inp.set_color(*controlColor); | ||
let mut check = button::CheckButton::default().with_label(" Check"); | ||
check.set_value(true); | ||
check.set_frame(enums::FrameType::FlatBox); | ||
let mut round = button::RoundButton::default().with_label(" Round"); | ||
round.set_value(true); | ||
round.set_frame(enums::FrameType::FlatBox); | ||
let mut btn = button::Button::default().with_label("Hello"); | ||
btn.set_color(*controlColor); | ||
btn.set_selection_color(*controlAccentColor); | ||
btn.set_frame(OS_DEFAULT_BUTTON_UP_BOX); | ||
col.end(); | ||
win.end(); | ||
win.make_resizable(true); | ||
win.show(); | ||
a.run().unwrap(); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod aqua; | ||
pub mod html; | ||
pub mod sweet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#![allow(non_upper_case_globals)] | ||
|
||
use fltk::enums::Color; | ||
use fltk::utils::oncelock::Lazy; | ||
|
||
pub static backgroundColor2: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((22, 25, 37, 255))); | ||
pub static windowBackgroundColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((24, 27, 40, 255))); | ||
pub static labelColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((195, 199, 209, 255))); | ||
pub static controlBackgroundColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((30, 34, 51, 255))); | ||
pub static secondaryLabelColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((102, 106, 115, 255))); | ||
pub static tertiaryLabelColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((102, 106, 115, 191))); | ||
pub static quaternaryLabelColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((102, 106, 115, 127))); | ||
pub static textColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((211, 218, 227, 255))); | ||
pub static placeholderTextColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((102, 106, 115, 255))); | ||
pub static selectedTextColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((254, 254, 254, 255))); | ||
pub static textBackgroundColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((30, 34, 51, 255))); | ||
pub static selectedTextBackgroundColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((197, 14, 210, 255))); | ||
pub static keyboardFocusIndicatorColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((197, 14, 210, 191))); | ||
pub static unemphasizedSelectedTextColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((254, 254, 254, 255))); | ||
pub static unemphasizedSelectedTextBackgroundColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((47, 52, 63, 255))); | ||
pub static linkColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((82, 148, 226, 255))); | ||
pub static separatorColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((102, 106, 115, 63))); | ||
pub static selectedContentBackgroundColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((197, 14, 210, 255))); | ||
pub static unemphasizedSelectedContentBackgroundColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((47, 52, 63, 255))); | ||
pub static selectedMenuItemTextColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((254, 254, 254, 255))); | ||
pub static gridColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((22, 25, 37, 255))); | ||
pub static headerTextColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((211, 218, 227, 255))); | ||
pub static origControlAccentColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((0, 232, 198, 255))); // Sweet's original green color for checkboxes | ||
pub static controlAccentColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((197, 14, 210, 255))); | ||
pub static controlColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((102, 106, 115, 191))); | ||
pub static controlTextColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((195, 199, 209, 255))); | ||
pub static disabledControlTextColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((102, 106, 115, 127))); | ||
pub static selectedControlColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((197, 14, 210, 255))); | ||
pub static selectedControlTextColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((195, 199, 209, 255))); | ||
pub static alternateSelectedControlTextColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((254, 254, 254, 255))); | ||
pub static scrubberTexturedBackgroundColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((211, 218, 227, 255))); | ||
pub static windowFrameTextColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((195, 199, 209, 255))); | ||
pub static underPageBackgroundColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((22, 25, 37, 255))); | ||
pub static findHighlightColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((255, 106, 0, 255))); | ||
pub static highlightColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((197, 14, 210, 255))); | ||
pub static shadowColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((0, 0, 0, 255))); | ||
pub static systemBrownColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((155, 123, 85, 255))); | ||
pub static systemFuchsiaColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((197, 14, 210, 255))); | ||
pub static systemGrayColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((133, 133, 139, 255))); | ||
pub static systemGreenColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((48, 211, 58, 255))); | ||
pub static systemIndigoColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((74, 64, 223, 255))); | ||
pub static systemOrangeColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((252, 141, 13, 255))); | ||
pub static systemPinkColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((251, 25, 76, 255))); | ||
pub static systemPurpleColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((157, 51, 213, 255))); | ||
pub static systemRedColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((251, 43, 44, 255))); | ||
pub static systemTealColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((76, 187, 242, 255))); | ||
pub static systemYellowColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((254, 207, 14, 255))); | ||
pub static systemBlueColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((16, 106, 254, 255))); | ||
pub static systemCyanColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((90, 200, 245, 255))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#![allow(non_upper_case_globals)] | ||
|
||
use fltk::enums::Color; | ||
use fltk::utils::oncelock::Lazy; | ||
|
||
pub static backgroundColor2: Lazy<Color> = Lazy::new(|| Color::from_rgb(230, 230, 230)); | ||
pub static windowBackgroundColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(232, 234, 235)); | ||
pub static labelColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(49, 54, 61)); | ||
pub static controlBackgroundColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(230, 230, 230)); | ||
pub static secondaryLabelColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(140, 142, 146)); | ||
pub static tertiaryLabelColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((140, 142, 146, 191))); | ||
pub static quaternaryLabelColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((140, 142, 146, 127))); | ||
pub static textColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(49, 54, 61)); | ||
pub static placeholderTextColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(140, 142, 146)); | ||
pub static selectedTextColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(254, 254, 254)); | ||
pub static textBackgroundColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(235, 240, 245)); | ||
pub static selectedTextBackgroundColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((197, 14, 210, 255))); | ||
pub static keyboardFocusIndicatorColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((197, 14, 210, 191))); | ||
pub static unemphasizedSelectedTextColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(254, 254, 254)); | ||
pub static unemphasizedSelectedTextBackgroundColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(232, 234, 236)); | ||
pub static linkColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(82, 148, 226)); | ||
pub static separatorColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((0, 0, 0, 63))); | ||
pub static selectedContentBackgroundColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((197, 14, 210, 255))); | ||
pub static unemphasizedSelectedContentBackgroundColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(232, 234, 236)); | ||
pub static selectedMenuItemTextColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(254, 254, 254)); | ||
pub static gridColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(22, 25, 37)); | ||
pub static headerTextColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(49, 54, 61)); | ||
pub static origControlAccentColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((0, 232, 198, 255))); // Sweet's original green color for checkboxes | ||
pub static controlAccentColor: Lazy<Color> = | ||
Lazy::new(|| Color::from_rgba_tuple((197, 14, 210, 255))); | ||
pub static controlColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((255, 255, 255, 255))); | ||
pub static controlTextColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(49, 54, 61)); | ||
pub static disabledControlTextColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((140, 142, 146, 127))); | ||
pub static selectedControlColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(197, 14, 210)); | ||
pub static selectedControlTextColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(49, 54, 61)); | ||
pub static alternateSelectedControlTextColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(254, 254, 254)); | ||
pub static scrubberTexturedBackgroundColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(211, 218, 227)); | ||
pub static windowFrameTextColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(49, 54, 61)); | ||
pub static underPageBackgroundColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(230, 230, 230)); | ||
pub static findHighlightColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(255, 106, 0)); | ||
pub static highlightColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(197, 14, 210)); | ||
pub static shadowColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((0, 0, 0, 255))); | ||
pub static systemBrownColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(155, 123, 85)); | ||
pub static systemFuchsiaColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(197, 14, 210)); | ||
pub static systemGrayColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(133, 133, 139)); | ||
pub static systemGreenColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(48, 211, 58)); | ||
pub static systemIndigoColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(74, 64, 223)); | ||
pub static systemOrangeColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(252, 141, 13)); | ||
pub static systemPinkColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(251, 25, 76)); | ||
pub static systemPurpleColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(157, 51, 213)); | ||
pub static systemRedColor: Lazy<Color> = Lazy::new(|| Color::from_rgb(251, 43, 44)); | ||
pub static systemTealColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((76, 187, 242, 255))); | ||
pub static systemYellowColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((254, 207, 14, 255))); | ||
pub static systemBlueColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((16, 106, 254, 255))); | ||
pub static systemCyanColor: Lazy<Color> = Lazy::new(|| Color::from_rgba_tuple((90, 200, 245, 255))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod dark; | ||
pub mod light; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ pub(crate) mod crystal; | |
pub mod fluent; | ||
pub(crate) mod gleam; | ||
pub(crate) mod svg_based; | ||
pub mod sweet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use fltk::{ | ||
app, draw, | ||
enums::{Color, FrameType}, | ||
}; | ||
|
||
fn up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { | ||
let col1 = c.to_rgb(); | ||
let col = Color::color_average(c, Color::Background, 0.8).to_rgb(); | ||
draw::draw_rbox(x, y, w, h, 5, true, Color::from_rgb(col.0, col.1, col.2)); | ||
} | ||
|
||
fn default_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { | ||
let col1 = c.to_rgb(); | ||
let col = Color::color_average(c, Color::Background, 0.8).to_rgb(); | ||
draw::draw_rbox(x, y, w, h, 5, true, Color::from_rgb(col.0, col.1, col.2)); | ||
} | ||
|
||
fn down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { | ||
let col1 = c.to_rgb(); | ||
let col = Color::color_average(c, Color::Background, 0.8).to_rgb(); | ||
draw::draw_rbox(x, y, w, h, 5, true, Color::from_rgb(col.0, col.1, col.2)); | ||
} | ||
|
||
fn radio_round_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { | ||
let col = c.to_rgb(); | ||
draw::draw_box(FrameType::OFlatBox, x, y, w, h, c); | ||
} | ||
|
||
fn border_box(x: i32, y: i32, w: i32, h: i32, c: Color) { | ||
draw::draw_rbox( | ||
x, | ||
y, | ||
w, | ||
h, | ||
5, | ||
true, | ||
*crate::colors::sweet::dark::systemFuchsiaColor, | ||
); | ||
} | ||
|
||
fn use_scheme() { | ||
app::set_scheme(app::Scheme::Gtk); | ||
// app::set_menu_linespacing(5); | ||
app::set_frame_type_cb(FrameType::UpBox, up_box, 2, 2, 4, 4); | ||
app::set_frame_type_cb(FrameType::DiamondUpBox, default_button_up_box, 2, 2, 4, 4); | ||
app::set_frame_type_cb(FrameType::DownBox, down_box, 2, 2, 4, 4); | ||
app::set_frame_type_cb(FrameType::DiamondDownBox, down_box, 2, 2, 4, 4); | ||
app::set_frame_type_cb(FrameType::RoundDownBox, radio_round_down_box, 2, 2, 4, 4); | ||
app::set_frame_type_cb(FrameType::BorderBox, border_box, 2, 2, 4, 4); | ||
} | ||
|
||
pub(crate) fn use_sweet_scheme() { | ||
use_scheme(); | ||
app::set_visible_focus(false); | ||
app::set_scrollbar_size(13); | ||
} | ||
|
||
pub mod frames { | ||
use fltk::enums::FrameType::{self, *}; | ||
pub const OS_DEFAULT_BUTTON_UP_BOX: FrameType = DiamondUpBox; | ||
pub const OS_DEFAULT_DEPRESSED_DOWN_BOX: FrameType = FrameType::DiamondDownBox; | ||
} |