Skip to content

Commit

Permalink
bring in more colors
Browse files Browse the repository at this point in the history
  • Loading branch information
MoAlyousef committed Sep 19, 2021
1 parent fa84eb3 commit d14d346
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
Cargo.lock
temp.*
18 changes: 18 additions & 0 deletions examples/aqua2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#[cfg(target_os = "macos")]
fn main() {
use fltk::{prelude::*, *};
use fltk_theme::{widget_themes, WidgetTheme, ThemeType};

let a = app::App::default();
let widget_theme = WidgetTheme::new(ThemeType::Aqua2);
widget_theme.apply();
let mut win = window::Window::default().with_size(400, 300);
let mut btn = button::Button::new(160, 200, 80, 30, "Hello");
btn.set_frame(widget_themes::OS_DEFAULT_BUTTON_UP_BOX);
win.end();
win.show();
a.run().unwrap();
}

#[cfg(not(target_os = "macos"))]
fn main() {}
65 changes: 65 additions & 0 deletions src/cocoa_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,69 @@ COLOR_GET(labelColor)

COLOR_GET(controlBackgroundColor)

COLOR_GET(windowFrameColor)

COLOR_GET(secondaryLabelColor)

COLOR_GET(tertiaryLabelColor)

COLOR_GET(quaternaryLabelColor)

COLOR_GET(textColor)

COLOR_GET(placeholderTextColor)

COLOR_GET(selectedTextColor)

COLOR_GET(textBackgroundColor)

COLOR_GET(selectedTextBackgroundColor)

COLOR_GET(keyboardFocusIndicatorColor)

COLOR_GET(unemphasizedSelectedTextColor)

COLOR_GET(unemphasizedSelectedTextBackgroundColor)

COLOR_GET(linkColor)

COLOR_GET(separatorColor)

COLOR_GET(selectedContentBackgroundColor)

COLOR_GET(unemphasizedSelectedContentBackgroundColor)

COLOR_GET(selectedMenuItemTextColor)

COLOR_GET(gridColor)

COLOR_GET(headerTextColor)

COLOR_GET(controlAccentColor)

COLOR_GET(controlColor)

COLOR_GET(controlTextColor)

COLOR_GET(disabledControlTextColor)

COLOR_GET(selectedControlColor)

COLOR_GET(selectedControlTextColor)

COLOR_GET(alternateSelectedControlTextColor)

COLOR_GET(scrubberTexturedBackgroundColor)

COLOR_GET(windowFrameTextColor)

COLOR_GET(underPageBackgroundColor)

COLOR_GET(findHighlightColor)

COLOR_GET(highlightColor)

COLOR_GET(shadowColor)



106 changes: 106 additions & 0 deletions src/cocoa_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,109 @@ extern "C" {
extern "C" {
pub fn my_controlBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_windowFrameColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_secondaryLabelColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_tertiaryLabelColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_quaternaryLabelColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_textColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_placeholderTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_selectedTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_textBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_selectedTextBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_keyboardFocusIndicatorColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_unemphasizedSelectedTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_unemphasizedSelectedTextBackgroundColor(
r: *mut f64,
g: *mut f64,
b: *mut f64,
a: *mut f64,
);
}
extern "C" {
pub fn my_linkColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_separatorColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_selectedContentBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_unemphasizedSelectedContentBackgroundColor(
r: *mut f64,
g: *mut f64,
b: *mut f64,
a: *mut f64,
);
}
extern "C" {
pub fn my_selectedMenuItemTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_gridColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_headerTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_controlAccentColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_controlColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_controlTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_disabledControlTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_selectedControlColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_selectedControlTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_alternateSelectedControlTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_scrubberTexturedBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_windowFrameTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_underPageBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_findHighlightColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_highlightColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
extern "C" {
pub fn my_shadowColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64);
}
44 changes: 35 additions & 9 deletions src/widget_themes/aqua2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,48 @@ macro_rules! get_colors {
}

lazy_static::lazy_static! {
static ref BG_COL: (u8, u8, u8, u8) = {
get_colors!(my_windowBackgroundColor)
};
static ref FG_COL: (u8, u8, u8, u8) = {
get_colors!(my_labelColor)
};
static ref BG_COL: (u8, u8, u8, u8) = get_colors!(my_windowBackgroundColor);
static ref FG_COL: (u8, u8, u8, u8) = get_colors!(my_labelColor);
static ref BG2_COL: (u8, u8, u8, u8) = {
if FG_COL.0 > 250 && FG_COL.1 > 250 && FG_COL.2 > 250 {
(0, 0, 0, 255)
} else {
(255, 255, 255, 255)
}
};
static ref CONTROL_COL: (u8, u8, u8, u8) = {
get_colors!(my_controlBackgroundColor)
};
static ref CONTROL_COL: (u8, u8, u8, u8) = get_colors!(my_controlBackgroundColor);
static ref FRAME_COL: (u8, u8, u8, u8) = get_colors!(my_windowFrameColor);
static ref LABEL2_COL: (u8, u8, u8, u8) = get_colors!(my_secondaryLabelColor);
static ref LABEL3_COL: (u8, u8, u8, u8) = get_colors!(my_tertiaryLabelColor);
static ref LABEL4_COL: (u8, u8, u8, u8) = get_colors!(my_quaternaryLabelColor);
static ref TXT_COL: (u8, u8, u8, u8) = get_colors!(my_textColor);
static ref PH_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_placeholderTextColor);
static ref SEL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_selectedTextColor);
static ref TXT_BG_COL: (u8, u8, u8, u8) = get_colors!(my_textBackgroundColor);
static ref SEL_TXT_BG_COL: (u8, u8, u8, u8) = get_colors!(my_selectedTextBackgroundColor);
static ref KB_IND_COL: (u8, u8, u8, u8) = get_colors!(my_keyboardFocusIndicatorColor);
static ref SEL_TXT2_COL: (u8, u8, u8, u8) = get_colors!(my_unemphasizedSelectedTextColor);
static ref SEL_TXT_BG2_COL: (u8, u8, u8, u8) = get_colors!(my_unemphasizedSelectedTextBackgroundColor);
static ref LINK_COL: (u8, u8, u8, u8) = get_colors!(my_linkColor);
static ref SEP_COL: (u8, u8, u8, u8) = get_colors!(my_separatorColor);
static ref SEL_BG_COL: (u8, u8, u8, u8) = get_colors!(my_selectedContentBackgroundColor);
static ref SEL_BG2_COL: (u8, u8, u8, u8) = get_colors!(my_unemphasizedSelectedContentBackgroundColor);
static ref SEL_MEN_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_selectedMenuItemTextColor);
static ref GRID_COL: (u8, u8, u8, u8) = get_colors!(my_gridColor);
static ref HDR_COL: (u8, u8, u8, u8) = get_colors!(my_headerTextColor);
static ref CTRL_ACC_COL: (u8, u8, u8, u8) = get_colors!(my_controlAccentColor);
static ref CTRL_COL: (u8, u8, u8, u8) = get_colors!(my_controlColor);
static ref CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_controlTextColor);
static ref DIS_CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_disabledControlTextColor);
static ref SEL_CTRL_COL: (u8, u8, u8, u8) = get_colors!(my_selectedControlColor);
static ref SEL_CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_selectedControlTextColor);
static ref ALT_SEL_CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_alternateSelectedControlTextColor);
static ref SCRUB_BG_COL: (u8, u8, u8, u8) = get_colors!(my_scrubberTexturedBackgroundColor);
static ref WIN_FRM_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_windowFrameTextColor);
static ref PAGE_BG_COL: (u8, u8, u8, u8) = get_colors!(my_underPageBackgroundColor);
static ref FIND_HLT_COL: (u8, u8, u8, u8) = get_colors!(my_findHighlightColor);
static ref HLT_COL: (u8, u8, u8, u8) = get_colors!(my_highlightColor);
static ref SHDW_COL: (u8, u8, u8, u8) = get_colors!(my_shadowColor);
}

fn aqua2_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) {
Expand Down

0 comments on commit d14d346

Please sign in to comment.