8 Commits
18 changed files with 354 additions and 82 deletions

No files matched your search

+13 -4
View File
@@ -1,14 +1,23 @@
# Color Picker
One Color Picker to rule them all! No overhelming menus and settings. Just a dialog with all the features you'll need:
One Color Picker to rule them all! No overhelming menus or settings. An easy tool with the features you need.
Features:
* Pick a color
* Choose between multiple Color Formats
* Let the Color History remember your last colors
![ColorPicker Screenshot](https://raw.github.com/ronnydo/colorpicker/master/data/screenshot.png)
## Appcenter
Color Picker will be soon available on [Appcenter](https://github.com/elementary/appcenter)!
## Installation
On elementaryOS? Simply install Color Picker from AppCenter:
<p align="center">
<a href="https://appcenter.elementary.io/com.github.ronnydo.colorpicker">
<img src="https://appcenter.elementary.io/badge.svg" alt="Get it on AppCenter">
</a>
</p>
Otherwise you can download and install the [latest .deb file](https://github.com/ronnydo/colorpicker/releases/latest).
## Dependencies
You'll need the following dependencies to build:
@@ -18,7 +27,7 @@ You'll need the following dependencies to build:
* valac
## Build, Install and Run
Call in the projects root folder:
Call in the project's root folder:
meson build && cd build
mesonconf -Dprefix=/usr
@@ -7,11 +7,12 @@
<name>Color Picker</name>
<summary>The most intuitive Color Picker to speed up your workflow.</summary>
<description>
<p>One Color Picker to rule them all! No overhelming menus and settings. Just a dialog with all the features you'll need:</p>
<p>One Color Picker to rule them all! No overhelming menus or settings. An easy tool with the features you need.</p>
<p>Features:</p>
<ul>
<li>Pick a color</li>
<li>Choose between multiple <b>Color Formats</b></li>
<li>Let the <b>Color History</b> remember your last colors</li>
<li>Choose between multiple Color Formats</li>
<li>Let the Color History remember your last colors</li>
</ul>
</description>
<provides>
+1 -1
View File
@@ -1,6 +1,6 @@
[Desktop Entry]
Name=Color Picker
Comment=The one and only Color Picker to speed up professionals workflow.
Comment=An intuitive Color Picker
Exec=com.github.ronnydo.colorpicker
Icon=com.github.ronnydo.colorpicker
Keywords=color;picker;selector;pipette;
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema path="/com/github/ronnydo/colorpicker/"
id="com.github.ronnydo.colorpicker"
gettext-domain="com.github.ronnydo.colorpicker">
<key name="window-x" type="i">
<default>-1</default>
<summary>Most recent x position of app window</summary>
<description>Most recent x position of app window</description>
</key>
<key name="window-y" type="i">
<default>-1</default>
<summary>Most recent y position of app window</summary>
<description>Most recent y position of app window</description>
</key>
<key name="color-format-index" type="i">
<default>2</default>
<summary>Most recent index of selected color format</summary>
<description>Most recent index of selected color format</description>
</key>
<key name="color-history" type="as">
<default>[]</default>
<summary>Color History</summary>
<description>Color History</description>
</key>
</schema>
</schemalist>
@@ -24,20 +24,32 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="899"
inkscape:window-width="1631"
inkscape:window-height="961"
id="namedview52"
showgrid="false"
showguides="false"
inkscape:zoom="0.99999999"
inkscape:cx="33.679442"
inkscape:cy="104.75812"
inkscape:zoom="2.8284271"
inkscape:cx="56.890517"
inkscape:cy="94.44466"
inkscape:window-x="1665"
inkscape:window-y="30"
inkscape:window-maximized="0"
inkscape:current-layer="svg5644" />
<defs
id="defs5646">
<linearGradient
inkscape:collect="always"
id="linearGradient4189">
<stop
style="stop-color:#f7f7f7;stop-opacity:1"
offset="0"
id="stop4191" />
<stop
style="stop-color:#f2f2f2;stop-opacity:1"
offset="1"
id="stop4193" />
</linearGradient>
<radialGradient
r="62.769119"
fy="193.04066"
@@ -179,6 +191,15 @@
gradientUnits="userSpaceOnUse"
id="radialGradient3163-0-2-6"
xlink:href="#linearGradient3820-7-2-8-6" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4189"
id="linearGradient4195"
x1="71.374176"
y1="40.012909"
x2="71.374176"
y2="97.085487"
gradientUnits="userSpaceOnUse" />
</defs>
<metadata
id="metadata5649">
@@ -315,19 +336,21 @@
</g>
<g
id="g4667"
transform="matrix(0.95399968,0,0,0.95399968,-3.7442232,0.37868768)">
transform="matrix(0.95399968,0,0,0.95399968,-3.7442232,0.37868768)"
style="fill-opacity:1;fill:url(#linearGradient4195)">
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
style="fill:url(#linearGradient4195);fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 97.330311,42.284792 a 7.0356347,7.1986844 39.729891 0 0 -3.278971,-1.929288 7.0356347,7.1986844 39.729891 0 0 -6.812034,1.857219 l -0.0015,-0.0015 -6.337307,6.363917 -2.41292,-2.423051 c -1.365731,-1.371466 -3.564848,-1.371466 -4.930579,0 -1.365732,1.371466 -1.365732,3.579818 0,4.951284 l 14.756822,14.818785 c 1.365732,1.371467 3.56485,1.371467 4.930581,0 1.365731,-1.371466 1.365731,-3.579816 0,-4.951282 l -2.41292,-2.423052 6.337307,-6.363916 -0.0034,-0.0034 a 7.0356347,7.1986844 39.729891 0 0 1.851392,-6.838692 7.0356347,7.1986844 39.729891 0 0 -1.686523,-3.057054 z"
id="rect8140-3-36" />
<g
transform="matrix(0.88241267,0,0,0.88241267,14.536297,13.778944)"
id="g4284">
id="g4284"
style="fill-opacity:1;fill:url(#linearGradient4195)">
<path
id="rect8172-9-2-12"
d="m 66.974129,47.701228 -26.992865,27.106208 -0.0077,0.0077 0.0023,0.0023 -7.963775,15.460251 3.818679,3.834713 15.395056,-7.997766 0.0023,0.0023 0.0077,-0.0077 L 78.228591,59.002947 66.974236,47.701336 Z"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
style="fill:url(#linearGradient4195);fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:connector-curvature="0" />
</g>
</g>

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

@@ -24,20 +24,32 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="842"
inkscape:window-height="961"
inkscape:window-width="1920"
inkscape:window-height="962"
id="namedview52"
showgrid="false"
showguides="false"
inkscape:zoom="1"
inkscape:cx="1.7438941"
inkscape:cy="77.729381"
inkscape:window-x="1753"
inkscape:window-y="38"
inkscape:window-maximized="0"
inkscape:zoom="11.313708"
inkscape:cx="25.239104"
inkscape:cy="9.6894688"
inkscape:window-x="1600"
inkscape:window-y="30"
inkscape:window-maximized="1"
inkscape:current-layer="svg5644" />
<defs
id="defs5646">
<linearGradient
inkscape:collect="always"
id="linearGradient4188">
<stop
style="stop-color:#f7f7f7;stop-opacity:1"
offset="0"
id="stop4190" />
<stop
style="stop-color:#f2f2f2;stop-opacity:1"
offset="1"
id="stop4192" />
</linearGradient>
<radialGradient
r="62.769119"
fy="193.04066"
@@ -230,6 +242,15 @@
xlink:href="#linearGradient3820-7-2-8-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.17524541,0,0,0.05575992,-1.3768094,18.119145)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4188"
id="linearGradient4194"
x1="71.341965"
y1="40.114685"
x2="71.341965"
y2="96.856537"
gradientUnits="userSpaceOnUse" />
</defs>
<metadata
id="metadata5649">
@@ -239,7 +260,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -353,19 +374,21 @@
</g>
<g
id="g4667"
transform="matrix(0.26169823,0,0,0.26169823,-2.5833858,-1.920854)">
transform="matrix(0.26169823,0,0,0.26169823,-2.5833858,-1.920854)"
style="fill-opacity:1;fill:url(#linearGradient4194)">
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
style="fill:url(#linearGradient4194);fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 97.330311,42.284792 a 7.0356347,7.1986844 39.729891 0 0 -3.278971,-1.929288 7.0356347,7.1986844 39.729891 0 0 -6.812034,1.857219 l -0.0015,-0.0015 -6.337307,6.363917 -2.41292,-2.423051 c -1.365731,-1.371466 -3.564848,-1.371466 -4.930579,0 -1.365732,1.371466 -1.365732,3.579818 0,4.951284 l 14.756822,14.818785 c 1.365732,1.371467 3.56485,1.371467 4.930581,0 1.365731,-1.371466 1.365731,-3.579816 0,-4.951282 l -2.41292,-2.423052 6.337307,-6.363916 -0.0034,-0.0034 a 7.0356347,7.1986844 39.729891 0 0 1.851392,-6.838692 7.0356347,7.1986844 39.729891 0 0 -1.686523,-3.057054 z"
id="rect8140-3-36" />
<g
transform="matrix(0.88241267,0,0,0.88241267,14.536297,13.778944)"
id="g4284">
id="g4284"
style="fill-opacity:1;fill:url(#linearGradient4194)">
<path
id="rect8172-9-2-12"
d="m 66.974129,47.701228 -26.992865,27.106208 -0.0077,0.0077 0.0023,0.0023 -7.963775,15.460251 3.818679,3.834713 15.395056,-7.997766 0.0023,0.0023 0.0077,-0.0077 L 78.228591,59.002947 66.974236,47.701336 Z"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
style="fill:url(#linearGradient4194);fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:connector-curvature="0" />
</g>
</g>

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

@@ -24,20 +24,32 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1004"
inkscape:window-height="902"
inkscape:window-width="1920"
inkscape:window-height="962"
id="namedview52"
showgrid="false"
showguides="false"
inkscape:zoom="11.313708"
inkscape:cx="9.9258038"
inkscape:cy="19.347888"
inkscape:window-x="1670"
inkscape:window-y="90"
inkscape:window-maximized="0"
inkscape:zoom="0.99999996"
inkscape:cx="177.80714"
inkscape:cy="48.432504"
inkscape:window-x="1600"
inkscape:window-y="30"
inkscape:window-maximized="1"
inkscape:current-layer="svg5644" />
<defs
id="defs5646">
<linearGradient
inkscape:collect="always"
id="linearGradient4187">
<stop
style="stop-color:#f7f7f7;stop-opacity:1"
offset="0"
id="stop4189" />
<stop
style="stop-color:#f2f2f2;stop-opacity:1"
offset="1"
id="stop4191" />
</linearGradient>
<radialGradient
r="62.769119"
fy="193.04066"
@@ -220,6 +232,15 @@
xlink:href="#linearGradient3820-7-2-8-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.27083381,0,0,0.08762273,-2.8550719,25.187228)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4187"
id="linearGradient4193"
x1="71.34787"
y1="40.12112"
x2="71.34787"
y2="96.729141"
gradientUnits="userSpaceOnUse" />
</defs>
<metadata
id="metadata5649">
@@ -344,19 +365,21 @@
</g>
<g
id="g4667"
transform="matrix(0.38566838,0,0,0.38566838,-3.3865983,-2.2984577)">
transform="matrix(0.38566838,0,0,0.38566838,-3.3865983,-2.2984577)"
style="fill-opacity:1;fill:url(#linearGradient4193)">
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
style="fill:url(#linearGradient4193);fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 97.330311,42.284792 a 7.0356347,7.1986844 39.729891 0 0 -3.278971,-1.929288 7.0356347,7.1986844 39.729891 0 0 -6.812034,1.857219 l -0.0015,-0.0015 -6.337307,6.363917 -2.41292,-2.423051 c -1.365731,-1.371466 -3.564848,-1.371466 -4.930579,0 -1.365732,1.371466 -1.365732,3.579818 0,4.951284 l 14.756822,14.818785 c 1.365732,1.371467 3.56485,1.371467 4.930581,0 1.365731,-1.371466 1.365731,-3.579816 0,-4.951282 l -2.41292,-2.423052 6.337307,-6.363916 -0.0034,-0.0034 a 7.0356347,7.1986844 39.729891 0 0 1.851392,-6.838692 7.0356347,7.1986844 39.729891 0 0 -1.686523,-3.057054 z"
id="rect8140-3-36" />
<g
transform="matrix(0.88241267,0,0,0.88241267,14.536297,13.778944)"
id="g4284">
id="g4284"
style="fill-opacity:1;fill:url(#linearGradient4193)">
<path
id="rect8172-9-2-12"
d="m 66.974129,47.701228 -26.992865,27.106208 -0.0077,0.0077 0.0023,0.0023 -7.963775,15.460251 3.818679,3.834713 15.395056,-7.997766 0.0023,0.0023 0.0077,-0.0077 L 78.228591,59.002947 66.974236,47.701336 Z"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
style="fill:url(#linearGradient4193);fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:connector-curvature="0" />
</g>
</g>

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

@@ -24,20 +24,32 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1009"
inkscape:window-height="961"
inkscape:window-width="1920"
inkscape:window-height="962"
id="namedview52"
showgrid="false"
showguides="false"
inkscape:zoom="7.38"
inkscape:cx="33.660156"
inkscape:cx="8.5246546"
inkscape:cy="29.967076"
inkscape:window-x="1665"
inkscape:window-x="1600"
inkscape:window-y="30"
inkscape:window-maximized="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg5644" />
<defs
id="defs5646">
<linearGradient
inkscape:collect="always"
id="linearGradient4196">
<stop
style="stop-color:#f7f7f7;stop-opacity:1"
offset="0"
id="stop4198" />
<stop
style="stop-color:#f2f2f2;stop-opacity:1"
offset="1"
id="stop4200" />
</linearGradient>
<radialGradient
r="62.769119"
fy="193.04066"
@@ -210,6 +222,15 @@
fx="99.189415"
fy="185.29727"
r="62.769119" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4196"
id="linearGradient4202"
x1="71.21978"
y1="40.17506"
x2="71.21978"
y2="97.163078"
gradientUnits="userSpaceOnUse" />
</defs>
<metadata
id="metadata5649">
@@ -219,7 +240,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -343,19 +364,21 @@
</g>
<g
id="g4667"
transform="matrix(0.54449711,0,0,0.54449711,-6.6651445,-5.3006778)">
transform="matrix(0.54449711,0,0,0.54449711,-6.6651445,-5.3006778)"
style="fill-opacity:1;fill:url(#linearGradient4202)">
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
style="fill:url(#linearGradient4202);fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 97.330311,42.284792 a 7.0356347,7.1986844 39.729891 0 0 -3.278971,-1.929288 7.0356347,7.1986844 39.729891 0 0 -6.812034,1.857219 l -0.0015,-0.0015 -6.337307,6.363917 -2.41292,-2.423051 c -1.365731,-1.371466 -3.564848,-1.371466 -4.930579,0 -1.365732,1.371466 -1.365732,3.579818 0,4.951284 l 14.756822,14.818785 c 1.365732,1.371467 3.56485,1.371467 4.930581,0 1.365731,-1.371466 1.365731,-3.579816 0,-4.951282 l -2.41292,-2.423052 6.337307,-6.363916 -0.0034,-0.0034 a 7.0356347,7.1986844 39.729891 0 0 1.851392,-6.838692 7.0356347,7.1986844 39.729891 0 0 -1.686523,-3.057054 z"
id="rect8140-3-36" />
<g
transform="matrix(0.88241267,0,0,0.88241267,14.536297,13.778944)"
id="g4284">
id="g4284"
style="fill-opacity:1;fill:url(#linearGradient4202)">
<path
id="rect8172-9-2-12"
d="m 66.974129,47.701228 -26.992865,27.106208 -0.0077,0.0077 0.0023,0.0023 -7.963775,15.460251 3.818679,3.834713 15.395056,-7.997766 0.0023,0.0023 0.0077,-0.0077 L 78.228591,59.002947 66.974236,47.701336 Z"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
style="fill:url(#linearGradient4202);fill-opacity:1;stroke:none;stroke-width:0.34900001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:connector-curvature="0" />
</g>
</g>

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

+5
View File
@@ -7,6 +7,11 @@ foreach i : icon_sizes
)
endforeach
install_data(
meson.project_name() + '.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
)
install_data(
meson.project_name() + '.desktop',
install_dir: join_paths(get_option('datadir'), 'applications')
Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 24 KiB

+8 -1
View File
@@ -1,8 +1,15 @@
com.github.ronnydo.colorpicker (0.9.3) xenial; urgency=medium
* Color Picker now restores your recent window position, color format color history! (issue #10, issue #11 and issue #15)
* Minor icon changes
-- Ronny Dobra <ronnydobra at arcor dot de> Thu, 26 Jun 2017 22:45:00 +0100
com.github.ronnydo.colorpicker (0.9.2) xenial; urgency=medium
* Fix issue #9
-- Ronny Dobra <ronnydobra at arcor dot de> Thu, 23 Jun 2017 17:1545:00 +0100
-- Ronny Dobra <ronnydobra at arcor dot de> Thu, 23 Jun 2017 17:15:00 +0100
com.github.ronnydo.colorpicker (0.9.1) xenial; urgency=medium
+4 -1
View File
@@ -24,15 +24,18 @@ executable(
'src/Widgets/ColorArea.vala',
'src/Widgets/ColorHistory.vala',
'src/Widgets/MousePosition.vala',
'src/Services/Settings.vala',
c_args: c_args,
dependencies: [
dependency('glib-2.0'),
dependency('gobject-2.0'),
dependency('granite'),
dependency('gtk+-3.0'),
],
install : true
)
#meson.add_install_script('meson/post_install.py')
meson.add_install_script('meson/post_install.py')
subdir('data')
subdir('po')
+8 -2
View File
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
@@ -20,9 +20,13 @@
*/
namespace ColorPicker {
// namespace-wide variable
public ColorPicker.Services.Settings settings;
public class ColorPickerApp : Granite.Application {
public ColorPickerApp () {
Object (application_id: "com.github.ronnydo.colorpicker",
flags: ApplicationFlags.FLAGS_NONE);
@@ -34,8 +38,10 @@ namespace ColorPicker {
return;
}
settings = ColorPicker.Services.Settings.get_instance ();
var app_window = new ColorPickerWindow (this);
app_window.show_all ();
var quit_action = new SimpleAction ("quit", null);
+58 -16
View File
@@ -22,9 +22,9 @@
namespace ColorPicker {
public class ColorPickerWindow: Gtk.Dialog {
ExtRGBA ext_active_color = ExtRGBA ();
public ColorPickerWindow (Gtk.Application application) {
Object (application: application,
icon_name: "com.github.ronnydo.colorpicker",
@@ -32,14 +32,14 @@ namespace ColorPicker {
resizable: false,
//height_request: 500,
width_request: 500
);
);
}
construct {
// main box
// main box
ext_active_color.parse ("#FFFFFF");
var color_area = new ColorArea ();
var color_area = new ColorPicker.Widgets.ColorArea ();
color_area.set_color (ext_active_color);
var hex_label = new Gtk.Label (ext_active_color.to_uppercase_hex_string ());
@@ -48,8 +48,7 @@ namespace ColorPicker {
hex_label.set_selectable (true);
hex_label.set_use_markup (true);
hex_label.get_style_context ().add_class ("h1");
hex_label.get_style_context ().add_class ("h1");
var pick_color_button = new Gtk.Button.with_label (_("Pick Color"));
pick_color_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
@@ -87,7 +86,7 @@ namespace ColorPicker {
color_format_combobox.append_text ("rgba");
color_format_combobox.append_text ("Gdk RGBA");
color_format_combobox.append_text ("Qt rgba");
color_format_combobox.active = 2;
color_format_combobox.active = settings.color_format_index;
var adjust_button = new Gtk.Button.from_icon_name ("media-eq-symbolic");
adjust_button.margin_start = 12;
@@ -108,7 +107,7 @@ namespace ColorPicker {
color_history_label.get_style_context ().add_class ("h4");
color_history_label.halign = Gtk.Align.START;
var color_history = new ColorHistory ();
var color_history = new ColorPicker.Widgets.ColorHistory ();
var color_history_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
color_history_box.margin_top = 6;
@@ -123,10 +122,35 @@ namespace ColorPicker {
skeleton_box.margin_bottom = 0;
skeleton_box.pack_start (main_box);
skeleton_box.pack_start (format_box);
var content_box = get_content_area () as Gtk.Box;
content_box.pack_start (skeleton_box);
content_box.pack_start (skeleton_box);
// restore old state
var color_list = color_history.get_color_list ();
if (color_list != null && color_list.size >= 1) {
ext_active_color = (ExtRGBA) color_list.last ();
hex_label.set_markup (ext_active_color.to_uppercase_hex_string ());
color_area.set_color (ext_active_color);
color_area.queue_draw ();
int id = color_format_combobox.get_active ();
update_color_format_combobox_text (format_entry, id);
if (color_list.size >= 2) {
skeleton_box.pack_start (color_history_box);
color_history_box.show_all ();
}
}
var window_x = settings.window_x;
var window_y = settings.window_y;
if (window_x != -1 || window_y != -1) {
move (window_x, window_y);
}
// activate color picker
pick_color_button.clicked.connect (() => {
var mouse_position = new ColorPicker.Widgets.MousePosition ();
@@ -142,6 +166,7 @@ namespace ColorPicker {
mouse_position.cancelled.connect (() => {
color_area.set_color (ext_active_color);
color_area.queue_draw ();
hex_label.set_markup (ext_active_color.to_uppercase_hex_string ());
mouse_position.close ();
this.present ();
});
@@ -158,10 +183,10 @@ namespace ColorPicker {
color_history.add_color (ext_active_color);
var color_list = color_history.get_color_list ();
var c_list = color_history.get_color_list ();
if (color_history_box.get_parent () == null) {
if (color_list != null && color_list.size > 1) {
if (c_list != null && c_list.size >= 2) {
skeleton_box.pack_start (color_history_box);
color_history_box.show_all ();
}
@@ -180,10 +205,15 @@ namespace ColorPicker {
}
});
//color_format_combobox.changed.connect (color_format_changed);
color_format_combobox.changed.connect (() => {
int id = color_format_combobox.get_active ();
update_color_format_combobox_text (format_entry, id);
ColorPicker.settings.color_format_index = id;
});
// handle changed color in color history
color_history.color_clicked.connect ((t, color) => {
@@ -198,7 +228,8 @@ namespace ColorPicker {
this.present ();
});
// trigger picker on startup
pick_color_button.clicked ();
}
@@ -226,6 +257,17 @@ namespace ColorPicker {
}
}
public override bool delete_event (Gdk.EventAny event) {
// save window position
int root_x, root_y;
get_position (out root_x, out root_y);
settings.window_x = root_x;
settings.window_y = root_y;
return false;
}
}
+46
View File
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2017 Ronny Dobra (https://github.com/RonnyDo/ColorPicker)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Ronny Dobra <ronnydobra at arcor dot de>
*/
namespace ColorPicker.Services {
public class Settings : Granite.Services.Settings {
private static Settings? instance = null;
public int window_x { get; set; }
public int window_y { get; set; }
public int color_format_index { get; set; }
public string[] color_history { get; set; }
public static Settings get_instance () {
if (instance == null) {
instance = new Settings ();
}
return instance;
}
private Settings () {
base ("com.github.ronnydo.colorpicker");
}
}
}
+1 -1
View File
@@ -19,7 +19,7 @@
* Authored by: Ronny Dobra <ronnydobra at arcor dot de>
*/
namespace ColorPicker {
namespace ColorPicker.Widgets {
public class ColorArea: Gtk.DrawingArea {
+43 -10
View File
@@ -18,7 +18,8 @@
*
* Authored by: Ronny Dobra <ronnydobra at arcor dot de>
*/
namespace ColorPicker {
namespace ColorPicker.Widgets {
public class ColorHistory: Gtk.DrawingArea {
@@ -46,25 +47,60 @@ namespace ColorPicker {
set_size_request (100, 28);
add_events(Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.ENTER_NOTIFY_MASK);
color_list = new Gee.ArrayList<Gdk.RGBA?> ();
restore_colors ();
border_color.parse (border_color_string);
triangle_color.parse (triangle_color_string);
triangle_color.parse (triangle_color_string);
}
construct {
//get_window ().set_cursor (new Gdk.Cursor (Gdk.CursorType.HAND2));
get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.HAND2));
get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.HAND2));
}
private void restore_colors () {
var color_array = settings.color_history;
if (color_array != null) {
// if more colors should be saved as allowed, drop the oldest ones.
if (max_colors < color_array.length) {
int offset = color_array.length - max_colors;
var sliced_array = color_array [offset:color_array.length];
color_array = sliced_array;
}
foreach (var color_value in color_array) {
Gdk.RGBA color = Gdk.RGBA();
color.parse(color_value);
color_list.add (color);
}
selected_color = color_list.size - 1;
}
}
private void store_colors () {
var c_list = get_color_list ();
string[] c_array = new string[c_list.size + 1];
for (int i = 0; i < c_list.size; i++) {
c_array[i] = c_list.get (i).to_string ();
}
settings.color_history = c_array;
}
public void add_color (Gdk.RGBA color) {
if (color_list.size == max_colors) {
if (color_list.size >= max_colors) {
remove_oldest_color ();
}
color_list.add (color);
selected_color = get_color_list ().size - 1;
store_colors ();
selected_color = get_color_list ().size - 1;
}
public void remove_oldest_color () {
color_list.remove_at (0);
store_colors ();
}
public Gee.ArrayList<Gdk.RGBA?> get_color_list () {
@@ -74,7 +110,6 @@ namespace ColorPicker {
/* Widget is asked to draw itself */
public override bool draw (Cairo.Context ctx) {
int width = get_allocated_width (); // better element_width / amount
int height = get_allocated_height ();
@@ -89,7 +124,7 @@ namespace ColorPicker {
ctx.rel_line_to (-1 * width / color_list.size - 1, 0);
ctx.close_path ();
Gdk.cairo_set_source_rgba (ctx, color_list.get(i));
Gdk.cairo_set_source_rgba (ctx, color_list.get (i));
ctx.fill ();
}
@@ -184,8 +219,6 @@ namespace ColorPicker {
public override bool button_release_event (Gdk.EventButton e) {
stdout.printf("clicked");
if (e.button != 1) {
return true;
}
+1
View File
@@ -22,6 +22,7 @@
namespace ColorPicker.Widgets {
public class MousePosition : Granite.Widgets.CompositedWindow {
public signal void picked (Gdk.RGBA color);
public signal void cancelled ();
public signal void moved (Gdk.RGBA color);