Skip to content

Commit

Permalink
refactor and rename colors
Browse files Browse the repository at this point in the history
  • Loading branch information
MoAlyousef committed Sep 29, 2021
1 parent 3c71255 commit c0bd63f
Show file tree
Hide file tree
Showing 15 changed files with 231 additions and 370 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ exclude = ["/screenshots", "./examples"]
fltk = "1.1.6"
lazy_static = "1.4"

[target.'cfg(target_os = "macos")'.build-dependencies]
cc = "1"
[target.'cfg(target_os = "macos")'.dependencies]
cocoa-colors = "0.1"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use fltk_theme::{widget_themes, WidgetTheme, ThemeType};

fn main() {
let a = app::App::default();
let widget_theme = WidgetTheme::new(ThemeType::Aqua);
let widget_theme = WidgetTheme::new(ThemeType::AquaClassic);
widget_theme.apply();
let mut win = window::Window::default().with_size(400, 300);
let mut btn = button::Button::new(160, 200, 80, 30, "Hello");
Expand Down Expand Up @@ -77,8 +77,8 @@ fn main() {
- Aero (Windows 7 theme)
- ![alt_test](screenshots/aero.jpg)

- Aqua (MacOS theme)
- ![alt_test](screenshots/aqua.jpg)
- AquaClassic (classic MacOS theme),
- ![alt_test](screenshots/aqua_classic.jpg)

- Dark
- ![alt_test](screenshots/dark.jpg)
Expand Down Expand Up @@ -153,7 +153,7 @@ You can check the frames example to see all `FrameType`'s you can apply to you w
## Widget Schemes

These provide schemes for widgets without color theming. Currently there are 6 schemes:
- Aqua: Tries to mimic MacOS's styles.
- Aqua: Tries to mimic the modern MacOS's styles.
- ![alt_test](screenshots/aqua_scheme.jpg)

- Fluent: Tries to mimic Window's 10 styles.
Expand Down
1 change: 0 additions & 1 deletion bind.sh

This file was deleted.

9 changes: 0 additions & 9 deletions build.rs

This file was deleted.

16 changes: 10 additions & 6 deletions examples/aqua_dark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,28 @@ use fltk_theme::widget_schemes::aqua::dark::*; // get all the dark aqua colors

fn main() {
let a = app::App::default();
app::background(BG_COL.0, BG_COL.1, BG_COL.2);
app::background2(CTRL_ACC_COL.0, CTRL_ACC_COL.1, CTRL_ACC_COL.2);
app::foreground(FG_COL.0, FG_COL.1, FG_COL.2);
app::background(windowBackgroundColor.0, windowBackgroundColor.1, windowBackgroundColor.2);
app::background2(controlAccentColor.0, controlAccentColor.1, controlAccentColor.2);
app::foreground(labelColor.0, labelColor.1, labelColor.2);
app::set_color(Color::Selection, 255, 255, 255);
let widget_scheme = WidgetScheme::new(SchemeType::Aqua);
widget_scheme.apply();
let mut win = window::Window::default().with_size(400, 300);
let mut inp = input::Input::new(50, 50, 300, 30, None);
inp.set_color(Color::from_tup(*FRAME_COL));
inp.set_color(Color::from_tup(*windowBackgroundColor).lighter());
// let mut choice = menu::Choice::new(100, 100, 200, 30, None);
// choice.set_color(Color::from_tup(*controlColor).lighter());
// choice.add_choice("Opt1|Opt2|Opt3");
// choice.set_value(2);
let mut check = button::CheckButton::new(160, 150, 80, 30, " Check");
check.set_value(true);
check.set_frame(enums::FrameType::FlatBox);
let mut round = button::RoundButton::new(160, 180, 80, 30, " Round");
round.set_value(true);
round.set_frame(enums::FrameType::FlatBox);
let mut btn = button::Button::new(160, 230, 80, 30, "Hello");
btn.set_color(Color::from_tup(*CTRL_COL));
btn.set_selection_color(Color::from_tup(*SYS_CYAN));
btn.set_color(Color::from_tup(*controlColor));
btn.set_selection_color(Color::from_tup(*systemCyanColor));
win.end();
win.make_resizable(true);
win.show();
Expand Down
6 changes: 3 additions & 3 deletions examples/fluent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use fltk_theme::widget_schemes::fluent::colors::*;

fn main() {
let a = app::App::default();
app::background(0xF0, 0xF0, 0xF0);
app::background(0xFC, 0xFC, 0xFC);
app::background2(0xFF, 0xFF, 0xFF);
app::foreground(0x00, 0x00, 0x00);
app::set_color(Color::Selection, SEL_COL.0, SEL_COL.1, SEL_COL.2);
app::set_color(Color::Selection, SELECTION_COLOR.0, SELECTION_COLOR.1, SELECTION_COLOR.2);
let theme = WidgetScheme::new(SchemeType::Fluent);
theme.apply();
let mut win = window::Window::default().with_size(400, 300);
Expand All @@ -23,7 +23,7 @@ fn main() {
round.set_value(true);
round.set_frame(FrameType::FlatBox);
let mut toggle = button::ToggleButton::new(100, 220, 80, 30, "Toggle");
toggle.set_color(Color::from_tup(*ACCENT_COL));
toggle.set_color(Color::from_tup(*ACCENT_COLOR));
toggle.set_label_color(Color::White);
toggle.set_selection_color(toggle.color().darker());
let mut btn = button::Button::new(220, 220, 80, 30, "Hello");
Expand Down
48 changes: 48 additions & 0 deletions examples/fluent_dark.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
use fltk::{prelude::*, enums::*, *};
use fltk_theme::{SchemeType, WidgetScheme};
use fltk_theme::widget_schemes::fluent::frames::*;
use fltk_theme::widget_schemes::fluent::colors::*;

fn main() {
let a = app::App::default();
app::background(0x00, 0x00, 0x00);
app::background2(0x00, 0x00, 0x00);
app::foreground(0xff, 0xff, 0xff);
app::set_color(Color::Selection, SELECTION_COLOR.0, SELECTION_COLOR.1, SELECTION_COLOR.2);
let theme = WidgetScheme::new(SchemeType::Fluent);
theme.apply();
let mut win = window::Window::default().with_size(400, 300);
let mut choice = menu::Choice::new(100, 100, 200, 30, None);
choice.add_choice("Fluent");
choice.set_value(0);
choice.set_frame(FrameType::FlatBox);
let mut check = button::CheckButton::new(160, 150, 80, 30, " Check");
check.set_value(true);
check.set_frame(FrameType::FlatBox);
let mut round = button::RoundButton::new(160, 180, 80, 30, " Round");
round.set_value(true);
round.set_frame(FrameType::FlatBox);
let mut toggle = button::ToggleButton::new(100, 220, 80, 30, "Toggle");
toggle.set_color(Color::from_tup(*ACCENT_COLOR));
toggle.set_label_color(Color::White);
toggle.set_selection_color(toggle.color().darker());
let mut btn = button::Button::new(220, 220, 80, 30, "Hello");
btn.set_frame(OS_DEFAULT_BUTTON_UP_BOX);
btn.set_down_frame(OS_DEFAULT_DEPRESSED_DOWN_BOX);
btn.handle(|b, ev| match ev {
Event::Enter => {
b.set_frame(OS_HOVERED_UP_BOX);
b.redraw();
true
},
Event::Leave => {
b.set_frame(OS_DEFAULT_BUTTON_UP_BOX);
b.redraw();
true
},
_ => false,
});
win.end();
win.show();
a.run().unwrap();
}
Binary file removed screenshots/aqua.jpg
Binary file not shown.
Binary file added screenshots/aqua_classic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 0 additions & 90 deletions src/cocoa_helper.h

This file was deleted.

4 changes: 0 additions & 4 deletions src/cocoa_helper.m

This file was deleted.

117 changes: 0 additions & 117 deletions src/cocoa_helper.rs

This file was deleted.

4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use fltk::{prelude::*, *};
use fltk_theme::{widget_themes, WidgetTheme, ThemeType};
let a = app::App::default();
let widget_theme = WidgetTheme::new(ThemeType::Aqua);
let widget_theme = WidgetTheme::new(ThemeType::AquaClassic);
widget_theme.apply();
let mut win = window::Window::default().with_size(400, 300);
let mut btn = button::Button::new(160, 200, 80, 30, "Hello");
Expand Down Expand Up @@ -69,8 +69,6 @@ fn main() {
#![allow(clippy::needless_doctest_main)]

use fltk::{app, enums::Color};
#[cfg(target_os = "macos")]
mod cocoa_helper;
pub mod color_themes;
pub mod widget_schemes;
pub mod widget_themes;
Expand Down
Loading

0 comments on commit c0bd63f

Please sign in to comment.