Skip to content

Commit

Permalink
update fltk
Browse files Browse the repository at this point in the history
  • Loading branch information
MoAlyousef committed Oct 7, 2021
1 parent 96af24e commit b212617
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fltk-theme"
version = "0.3.0"
version = "0.3.1"
authors = ["MoAlyousef <[email protected]>"]
edition = "2018"
description = "A theming crate for fltk-rs"
Expand All @@ -13,7 +13,7 @@ license = "MIT"
exclude = ["/screenshots", "./examples"]

[dependencies]
fltk = "1.2"
fltk = "1.2.7"
lazy_static = "1.4"

[target.'cfg(target_os = "macos")'.dependencies]
Expand Down
10 changes: 1 addition & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,6 @@ pub trait FromColor {

impl FromColor for Color {
fn from_rgba(tup: (u8, u8, u8, u8)) -> Color {
let bg_col = Color::BackGround.to_rgb();
let alpha = tup.3 as f32 / 255.0;
let r = alpha * tup.0 as f32 + (1.0 - alpha) * bg_col.0 as f32;
let r = r as u8;
let g = alpha * tup.1 as f32 + (1.0 - alpha) * bg_col.1 as f32;
let g = g as u8;
let b = alpha * tup.2 as f32 + (1.0 - alpha) * bg_col.2 as f32;
let b = b as u8;
Color::from_rgb(r, g, b)
Color::from_rgba_tuple(tup)
}
}
14 changes: 7 additions & 7 deletions src/widget_schemes/aqua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ fn default_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) {
fn down_box(x: i32, y: i32, w: i32, h: i32, c: Color) {
let col = c.to_rgb();
let svg = format!(
"<svg viewBox='-1 -1 {0} {1}'>
"<svg viewBox='0 0 {0} {1}'>
<defs>
<linearGradient id='grad1' x1='0%' y1='0%' x2='0%' y2='100%'>
<stop offset='0%' style='stop-color:rgb({2},{3},{4});stop-opacity:1' />
Expand All @@ -259,8 +259,8 @@ fn down_box(x: i32, y: i32, w: i32, h: i32, c: Color) {
</defs>
<rect width='{0}' height='{1}' rx='{8}' fill='url(#grad1)' />
</svg>",
w - 1,
h - 1,
w,
h,
col.0 - 10,
col.1 - 10,
col.2 - 10,
Expand Down Expand Up @@ -296,9 +296,9 @@ fn border_box(x: i32, y: i32, w: i32, h: i32, c: Color) {
use crate::FromColor;
draw::draw_box(
FrameType::RFlatBox,
x,
x + 1,
y + 1,
w - 1,
w - 2,
h - 2,
Color::from_rgba(*self::dark::systemBlueColor),
);
Expand All @@ -308,8 +308,8 @@ fn use_scheme() {
app::set_scheme(app::Scheme::Gtk);
app::set_frame_type_cb(FrameType::UpBox, up_box, 1, 1, 2, 2);
app::set_frame_type_cb(FrameType::DiamondUpBox, default_button_up_box, 1, 1, 2, 2);
app::set_frame_type_cb(FrameType::DownBox, down_box, 1, 1, 2, 2);
app::set_frame_type_cb(FrameType::DiamondDownBox, down_box, 1, 1, 2, 2);
app::set_frame_type_cb(FrameType::DownBox, down_box, 0, 0, 0, 0);
app::set_frame_type_cb(FrameType::DiamondDownBox, down_box, 0, 0, 0, 0);
app::set_frame_type_cb(FrameType::RoundDownBox, radio_round_down_box, 2, 2, 4, 4);
app::set_frame_type_cb(FrameType::BorderBox, border_box, 1, 1, 2, 2);
}
Expand Down

0 comments on commit b212617

Please sign in to comment.