Skip to content

Commit

Permalink
0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
MoAlyousef committed Jul 23, 2021
1 parent 010e218 commit c15a416
Show file tree
Hide file tree
Showing 16 changed files with 189 additions and 14 deletions.
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,13 @@ fn main() {
- Greybird (Gnome xfce)
![alt_test](screenshots/greybird.jpg)


## Color themes

- Black theme
![alt_test](screenshots/black.jpg)

- Dark theme
![alt_test](screenshots/dark_color.JPG)
![alt_test](screenshots/dark_color.jpg)

- Plain gray theme
![alt_test](screenshots/plain-gray.jpg)
Expand All @@ -92,3 +91,39 @@ fn main() {

- Shake theme
![alt_test](screenshots/shake.jpg)

## FrameTypes

Choosing a WidgetTheme will also define a set of FrameTypes which can be used for your widgets.
```
OS_BUTTON_UP_BOX
OS_CHECK_DOWN_BOX
OS_BUTTON_UP_FRAME
OS_CHECK_DOWN_FRAME
OS_PANEL_THIN_UP_BOX
OS_SPACER_THIN_DOWN_BOX
OS_PANEL_THIN_UP_FRAME
OS_SPACER_THIN_DOWN_FRAME
OS_RADIO_ROUND_DOWN_BOX
OS_HOVERED_UP_BOX
OS_DEPRESSED_DOWN_BOX
OS_HOVERED_UP_FRAME
OS_DEPRESSED_DOWN_FRAME
OS_INPUT_THIN_DOWN_BOX
OS_INPUT_THIN_DOWN_FRAME
OS_MINI_BUTTON_UP_BOX
OS_MINI_DEPRESSED_DOWN_BOX
OS_MINI_BUTTON_UP_FRAME
OS_MINI_DEPRESSED_DOWN_FRAME
OS_DEFAULT_BUTTON_UP_BOX
OS_DEFAULT_HOVERED_UP_BOX
OS_DEFAULT_DEPRESSED_DOWN_BOX
OS_TOOLBAR_BUTTON_HOVER_BOX
OS_TABS_BOX
OS_SWATCH_BOX
OS_SWATCH_FRAME
OS_BG_BOX
```

You can check the frames example to see all `FrameType`'s you can apply to you widgets.
![alt_test](screenshots/frames.jpg)
118 changes: 118 additions & 0 deletions examples/frames.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
use fltk::{prelude::*, *};
use fltk_theme::{widget_themes::*, ThemeType, WidgetTheme};

fn main() {
let a = app::App::default();
let theme = WidgetTheme::new(ThemeType::Aqua);
theme.apply();
let mut win = window::Window::default().with_size(800, 800);
let mut choice = menu::Choice::new(300, 10, 200, 30, None);
choice.add_choice("Classic|Aero|Metro|Aqua|Greybird|Blue|HighContrast|Dark");
choice.set_value(3);
choice.set_frame(OS_PANEL_THIN_UP_BOX);
let mut vgrid = group::VGrid::new(50, 100, 700, 700, None);
vgrid.set_params(6, 6, 5);
let mut frame = frame::Frame::default().with_label(&"BUTTON_UP_BOX".to_lowercase());
frame.set_frame(OS_BUTTON_UP_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"CHECK_DOWN_BOX".to_lowercase());
frame.set_frame(OS_CHECK_DOWN_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"BUTTON_UP_FRAME".to_lowercase());
frame.set_frame(OS_BUTTON_UP_FRAME);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"CHECK_DOWN_FRAME".to_lowercase());
frame.set_frame(OS_CHECK_DOWN_FRAME);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"PANEL_THIN_UP_BOX".to_lowercase());
frame.set_frame(OS_PANEL_THIN_UP_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"SPACER_THIN_DOWN_BOX".to_lowercase());
frame.set_frame(OS_SPACER_THIN_DOWN_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"PANEL_THIN_UP_FRAME".to_lowercase());
frame.set_frame(OS_PANEL_THIN_UP_FRAME);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"SPACER_THIN_DOWN_FRAME".to_lowercase());
frame.set_frame(OS_SPACER_THIN_DOWN_FRAME);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"RADIO_ROUND_DOWN_BOX".to_lowercase());
frame.set_frame(OS_RADIO_ROUND_DOWN_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"HOVERED_UP_BOX".to_lowercase());
frame.set_frame(OS_HOVERED_UP_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"DEPRESSED_DOWN_BOX".to_lowercase());
frame.set_frame(OS_DEPRESSED_DOWN_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"HOVERED_UP_FRAME".to_lowercase());
frame.set_frame(OS_HOVERED_UP_FRAME);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"DEPRESSED_DOWN_FRAME".to_lowercase());
frame.set_frame(OS_DEPRESSED_DOWN_FRAME);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"INPUT_THIN_DOWN_BOX".to_lowercase());
frame.set_frame(OS_INPUT_THIN_DOWN_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"INPUT_THIN_DOWN_FRAME".to_lowercase());
frame.set_frame(OS_INPUT_THIN_DOWN_FRAME);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"MINI_BUTTON_UP_BOX".to_lowercase());
frame.set_frame(OS_MINI_BUTTON_UP_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"MINI_DEPRESSED_DOWN_BOX".to_lowercase());
frame.set_frame(OS_MINI_DEPRESSED_DOWN_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"MINI_BUTTON_UP_FRAME".to_lowercase());
frame.set_frame(OS_MINI_BUTTON_UP_FRAME);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"MINI_DEPRESSED_DOWN_FRAME".to_lowercase());
frame.set_frame(OS_MINI_DEPRESSED_DOWN_FRAME);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"DEFAULT_BUTTON_UP_BOX".to_lowercase());
frame.set_frame(OS_DEFAULT_BUTTON_UP_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"DEFAULT_HOVERED_UP_BOX".to_lowercase());
frame.set_frame(OS_DEFAULT_HOVERED_UP_BOX);
frame.set_label_size(10);
let mut frame =
frame::Frame::default().with_label(&"DEFAULT_DEPRESSED_DOWN_BOX".to_lowercase());
frame.set_frame(OS_DEFAULT_DEPRESSED_DOWN_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"TOOLBAR_BUTTON_HOVER_BOX".to_lowercase());
frame.set_frame(OS_TOOLBAR_BUTTON_HOVER_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"TABS_BOX".to_lowercase());
frame.set_frame(OS_TABS_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"SWATCH_BOX".to_lowercase());
frame.set_frame(OS_SWATCH_BOX);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"SWATCH_FRAME".to_lowercase());
frame.set_frame(OS_SWATCH_FRAME);
frame.set_label_size(10);
let mut frame = frame::Frame::default().with_label(&"BG_BOX".to_lowercase());
frame.set_frame(OS_BG_BOX);
frame.set_label_size(10);
frame::Frame::default();
frame::Frame::default();
frame::Frame::default();
vgrid.end();
win.end();
win.show();
choice.set_callback(|c| {
let theme = match c.value() {
0 => WidgetTheme::new(ThemeType::Classic),
1 => WidgetTheme::new(ThemeType::Aero),
2 => WidgetTheme::new(ThemeType::Metro),
3 => WidgetTheme::new(ThemeType::Aqua),
4 => WidgetTheme::new(ThemeType::Greybird),
5 => WidgetTheme::new(ThemeType::Blue),
6 => WidgetTheme::new(ThemeType::HighContrast),
7 => WidgetTheme::new(ThemeType::Dark),
_ => WidgetTheme::new(ThemeType::Classic),
};
theme.apply();
});
a.run().unwrap();
}
2 changes: 1 addition & 1 deletion examples/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ fn main() {
win.end();
win.show();
a.run().unwrap();
}
}
4 changes: 2 additions & 2 deletions examples/hello.rs → examples/predef_color.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use fltk::{prelude::*, *};
use fltk_theme::{ColorTheme, color_themes};
use fltk_theme::{color_themes, ColorTheme};

fn main() {
let a = app::App::default().with_scheme(app::Scheme::Gtk);
let theme = ColorTheme::from_colormap(color_themes::BLACK_THEME);
let theme = ColorTheme::from_colormap(color_themes::DARK_THEME);
theme.apply();
let mut win = window::Window::default().with_size(400, 300);
let mut btn = button::Button::new(160, 200, 80, 40, "Hello");
Expand Down
32 changes: 27 additions & 5 deletions examples/widget_theme.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
use fltk::{prelude::*, *};
use fltk_theme::{widget_themes, WidgetTheme, ThemeType};
use fltk_theme::{widget_themes, ThemeType, WidgetTheme};

fn main() {
let a = app::App::default();
let widget_theme = WidgetTheme::new(ThemeType::Aqua);
widget_theme.apply();
let theme = WidgetTheme::new(ThemeType::Aqua);
theme.apply();
let mut win = window::Window::default().with_size(400, 300);
let mut btn = button::Button::new(160, 200, 80, 30, "Hello");
let mut choice = menu::Choice::new(100, 100, 200, 30, None);
choice.add_choice("Classic|Aero|Metro|Aqua|Greybird|Blue|HighContrast|Dark");
choice.set_value(3);
choice.set_frame(widget_themes::OS_PANEL_THIN_UP_BOX);
let mut check = button::CheckButton::new(160, 150, 80, 30, "Check");
check.set_value(true);
let mut round = button::RoundButton::new(160, 180, 80, 30, "Round");
round.set_value(true);
let mut btn = button::Button::new(160, 220, 80, 30, "Hello");
btn.set_frame(widget_themes::OS_DEFAULT_BUTTON_UP_BOX);
win.end();
win.show();
choice.set_callback(|c| {
let theme = match c.value() {
0 => WidgetTheme::new(ThemeType::Classic),
1 => WidgetTheme::new(ThemeType::Aero),
2 => WidgetTheme::new(ThemeType::Metro),
3 => WidgetTheme::new(ThemeType::Aqua),
4 => WidgetTheme::new(ThemeType::Greybird),
5 => WidgetTheme::new(ThemeType::Blue),
6 => WidgetTheme::new(ThemeType::HighContrast),
7 => WidgetTheme::new(ThemeType::Dark),
_ => WidgetTheme::new(ThemeType::Classic),
};
theme.apply();
});
a.run().unwrap();
}
}
Binary file modified screenshots/aero.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/aqua.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/blue.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/classic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/dark.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/dark_color.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/frames.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/greybird.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/high_contrast.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/metro.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/color_themes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
mod tan;
mod black;
mod dark;
mod gray;
mod shake;
mod dark;
mod tan;

pub use tan::*;
pub use black::*;
pub use dark::*;
pub use gray::*;
pub use shake::*;
pub use dark::*;
pub use tan::*;

0 comments on commit c15a416

Please sign in to comment.