Skip to content

Commit

Permalink
* - Make window small like a toolbox app
Browse files Browse the repository at this point in the history
  • Loading branch information
Lains committed Apr 18, 2022
1 parent 1657983 commit e09abfa
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions data/io.github.lainsce.Colorway.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<release version="1.1.1" date="2022-04-20">
<description>
<p>Changed: UI now follows my own style that complements that of Adwaita, called Solo.</p>
<p>Changed: Window size reduced dramatically.</p>
</description>
</release>
<release version="1.1.0" date="2022-02-11">
Expand Down
Binary file modified data/shot-dark.png
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 data/shot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions data/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,18 @@
border-radius: 999px;
}
.clr-color {
border-radius: 999px;
border-radius: 999px 0 0 999px;
box-shadow: inset 0 0 0 1px @borders;
}
.clr-color-mid {
border-radius: 0px;
box-shadow: inset 0 0 0 1px @borders;
}
.clr-color-end {
border-radius: 0 999px 999px 0;
box-shadow: inset 0 0 0 1px @borders;
}

.clr-palette button image {
color: #fff;
}
Expand All @@ -58,6 +67,6 @@
font-size: 1.5rem;
font-weight: 600;
margin: 0;
padding: 0;
padding: 2px;
background: none;
}
14 changes: 7 additions & 7 deletions data/ui/window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<child type="title">
<object class="GtkBox" />
</child>
<child type="start">
<child type="end">
<object class="GtkMenuButton" id="menu_button">
<property name="icon-name">open-menu-symbolic</property>
<style>
Expand Down Expand Up @@ -52,10 +52,10 @@
<child>
<object class="GtkBox" id="props_box">
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<property name="margin-top">47</property>
<property name="spacing">6</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">5</property>
<child>
<object class="GtkEntry" id="color_label">
<property name="max-width-chars">7</property>
Expand Down Expand Up @@ -85,8 +85,8 @@
<object class="GtkBox">
<property name="valign">end</property>
<property name="halign">end</property>
<property name="margin-bottom">18</property>
<property name="margin-end">18</property>
<property name="margin-bottom">12</property>
<property name="margin-end">12</property>
<child>
<object class="GtkButton" id="color_picker_button">
<property name="icon-name">color-picker-symbolic</property>
Expand Down
16 changes: 7 additions & 9 deletions src/window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -107,28 +107,26 @@ namespace Colorway {
color_rule_dropdown.append_text(_("Monochromatic"));
color_rule_dropdown.set_active(3);
color_rule_dropdown.set_halign (Gtk.Align.START);
color_rule_dropdown.margin_bottom = 40;
color_rule_dropdown.margin_bottom = 12;

box = new PaletteButton ("#111", false);
box.set_size_request(44, 44);
box.get_style_context ().add_class ("clr-color");
sbox = new PaletteButton ("#111", false);
sbox.set_size_request(44, 44);
sbox.set_visible(false);
sbox.get_style_context ().add_class ("clr-color");
sbox.get_style_context ().add_class ("clr-color-mid");
tbox = new PaletteButton ("#111", false);
tbox.set_size_request(44, 44);
tbox.set_visible(false);
tbox.get_style_context ().add_class ("clr-color");
tbox.get_style_context ().add_class ("clr-color-mid");
ubox = new PaletteButton ("#111", false);
ubox.set_size_request(44, 44);
ubox.get_style_context ().add_class ("clr-color");
ubox.get_style_context ().add_class ("clr-color-end");

mbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
mbox.set_halign (Gtk.Align.CENTER);
mbox.set_valign (Gtk.Align.START);
mbox.set_halign (Gtk.Align.START);
mbox.overflow = HIDDEN;
mbox.set_spacing (30);
mbox.get_style_context ().add_class ("clr-palette");
mbox.append (box);
mbox.append (sbox);
Expand Down Expand Up @@ -577,12 +575,12 @@ namespace Colorway {
var snap = new Gtk.Snapshot ();
mbox.snapshot (snap);

var sf = new Cairo.ImageSurface (Cairo.Format.ARGB32, 260, 32); // 260×32 is the color result box size;
var sf = new Cairo.ImageSurface (Cairo.Format.ARGB32, 176, 44); // 260×32 is the color result box size;
var cr = new Cairo.Context (sf);
var node = snap.to_node ();
node.draw(cr);

var pb = Gdk.pixbuf_get_from_surface (sf, 0, 0, 260, 32);
var pb = Gdk.pixbuf_get_from_surface (sf, 0, 0, 176, 44);
var mt = Gdk.Texture.for_pixbuf (pb);

var display = Gdk.Display.get_default ();
Expand Down

0 comments on commit e09abfa

Please sign in to comment.