You are not logged in.
Hello everyone,
Here I am, accouncing any of my projects publicly for the first time! I am trying to switch to as much GTK3 applications as possible (and, ultimately, try ditch as many GTK2). It has always bothered me that there is no GTK3 alternative to something as simple as Gcolor2. Today, I just quickly whipped it up myself, after having gained some experience in GTK3 from my previous (yet unnanounced) project.
It's very, very simple (93 SLOC, of which most are the About dialog ) and for now, it consists of a color wheel and number of sliders and entry boxes for color parameters. You can also pick a color on the desktop. I never used the color-saving feature of Gcolor2, so for now I have not implemented it. Anything is possible though, upon request
Feedback - on everything; the application itself and the Makefile - would be appreciated. My experience with Makefiles is limited, so if anything could be improved (in general, or to help compatibility with other distributions for example) please let me know!
I think that's it!
EDIT: Oh, darn, it's not. You can find the project here!
AUR: https://aur.archlinux.org/packages/gcolor3/
AUR Git version: https://aur.archlinux.org/packages/gcolor3-git/
Last edited by Unia (2013-06-21 14:39:24)
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Very nice
Offline
+1 very nice replacement for Gcolor2
Lenovo G50 | LXQT-git | compton | conky
Offline
Did you know about "zenity --color-selection"?
Offline
Congratulation. I was looking for a small gtk3 alternative for a long time.
Do you make use of the "Color Selector" from GTK which can be found when you run gtk-demo?
Offline
Did you know about "zenity --color-selection"?
Nope, I did not. Oh well
Congratulation. I was looking for a small gtk3 alternative for a long time.
Do you make use of the "Color Selector" from GTK which can be found when you run gtk-demo?
Nope, gtk-demo is still gtk2.
Thanks for the positive replies, guys!
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Update: Gcolor3 now has a treeview inside an expander (just as Gcolor2, of course) which lists your saved colors. These colors are also exported to a file ($HOME/.rgb.txt), just like - of course - Gcolor2.
I am currently aware of one bug, but I have not yet discovered why. A quick example: save three colors:
#FF0000 RED
#00FF00 GREEN
#0000FF BLUE
Then, delete GREEN. As expected, the green color is removed from the treeview and the rgb.txt file. However, also the blue color is removed from the rgb.txt file. If you could help me decipher a pattern, I would appreciate this
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Update: Gcolor3 now has a treeview inside an expander (just as Gcolor2, of course) which lists your saved colors. These colors are also exported to a file ($HOME/.rgb.txt), just like - of course - Gcolor2.
I am currently aware of one bug, but I have not yet discovered why. A quick example: save three colors:
#FF0000 RED #00FF00 GREEN #0000FF BLUE
Then, delete GREEN. As expected, the green color is removed from the treeview and the rgb.txt file. However, also the blue color is removed from the rgb.txt file. If you could help me decipher a pattern, I would appreciate this
Also while saving even when we click on cancel, the color is getting saved.
Heres the patch for both of this, just very minor change, so adding it in here
diff --git a/gcolor3.c b/gcolor3.c
index f5ca753..7ed1f09 100644
--- a/gcolor3.c
+++ b/gcolor3.c
@@ -149,7 +149,7 @@ save_dialog_open (void)
save_dialog_cancel_button = gtk_button_new_from_stock ("gtk-cancel");
gtk_widget_show (save_dialog_cancel_button);
- gtk_dialog_add_action_widget (GTK_DIALOG (save_dialog), save_dialog_cancel_button, GTK_RESPONSE_OK);
+ gtk_dialog_add_action_widget (GTK_DIALOG (save_dialog), save_dialog_cancel_button, GTK_RESPONSE_CANCEL);
gtk_widget_set_sensitive (save_dialog_cancel_button, TRUE);
gtk_widget_set_can_default(save_dialog_cancel_button, TRUE);
@@ -319,7 +319,7 @@ delete_color (gchar *color_name, gchar *color_value)
/* make sure to only remove the first matching color; both value and name must match */
if (found || strcmp (file_color_name, color_name) != 0 || strcmp (g_ascii_strup (file_color_value, -1), color_value) != 0) {
- g_sprintf (newstuff, "%s%3d %3d %3d\t\t%s\n", newstuff, r, g, b, file_color_name);
+ g_sprintf (newstuff+strlen(newstuff), "%3d %3d %3d\t\t%s\n", r, g, b, file_color_name);
} else {
found = TRUE;
}
Offline
Whoops, I didn't notice that save_dialog_cancel_button bug. Thanks for reporting!
Also, your fix for deleting colors works! I will look into it as to why, since gcolor2 (where I based this code on) does not have it and it works there.
Thanks for your time and input; I appreciate it!
Last edited by Unia (2013-03-04 11:35:44)
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
@Unia
I guess for while printing to buffer 'newstuff' it overwrites the existing one, since it starts from the first position always.
I looked through the documentation to see if writing back the buffer to itself should cause any problem, but didn't find anything, However, that is what is causing the error.
Do let me know if you find any documentation on this.
Offline
I quickly skimmed through Gcolor2's code again and noticed my function was slightly altered:
Gcolor2: g_sprintf (file_color_value, "#%2X%2X%2X", r, g, b);
Gcolor3: g_sprintf (file_color_value, "#%.2X%.2X%.2X", r, g, b);
I remember changing it, because otherwise it wouldn't even delete a color from the treeview (and when it can't delete from the treeview, it won't delete from the file either).
So, I guess that had something to do with it aswell, because otherwise I didn't change anything in the delete function from Gcolor2.
Writing back into the same buffer shouldn't cause any problem, AFAIK.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
This is nice. Thanks !
Offline
You're welcome!
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Feel free to copy features from pychrom. If you copy enough then I won't have to rewrite it.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Feel free to copy features from pychrom. If you copy enough then I won't have to rewrite it.
Just name a feature you would like to see implemented and I'll see what I can do
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Just pushed a big update to GitHub: the source is now split across multiple files for easier editing and I cleaned it up a tad. No features were removed or added, but I thought I'd give you a heads up in case you rebuilt it and notice new bugs
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
I've just imported Gcolor3 into Anjuta for easier project management and to be (more easily) compatible with other distributions. I'm still exploring things (I still have to figure out how to install the .desktop file, for example) but I thought I'd give you a heads up. There's no actual changes to the code, but a big advantage from this switch is the enabling of translations.
Yes, that's right, you can now translate Gcolor3 in your own language. Since it's a small application, the translating should not take more than five minutes. I would highly appreciate your efforts if you could translate! Instructions can be found in the GitHub repository's README.md.
Last edited by Unia (2013-06-09 19:51:01)
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
As we're nearing a stable 1.0 release (I finally solved the bug that was there since I added the treeview and that I've been looking into for a month ), I thought it would be time to have a Page on GitHub. Perhaps this will help spread the word on Gcolor3!
http://unia.github.io/gcolor3/
Last edited by Unia (2013-06-10 12:52:26)
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
I've released version 1.0! From now on, I will only add bug fixes and add new or update existing translations.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
This is nice!
Sorry for my bad English
Offline
Gcolor3 just got updated to version 1.2! It now uses GTK 3.10's GtkHeaderbar and a GtkStack to switch between the color chooser and the saved colors. Functionally, it's completely the same
Let me know what you think!
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Thank you!
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
I was just going to switch gcolor2 to this, but I gotta admit I don't like the new layout at all.
it takes too much screen estate compared to old version. also the gtk header bar looks very ununiform, at least with my theme and language settings. also the bottom of the window looks weird for my eye somehow, now that there's no spacing below the color selector.
maybe you could make the header more compact somehow, by using icons instead of text for example, or maybe unifying the buttons to a single menu although that would make it slightly less 'usable'.
the rgb spin buttons should be thinner as well. The maximum value for those has 3 digits, and currently there's space for nearly 15 digits which seems just pointless.
please don't take this the wrong way. I really appreciate what you've done, simply wanted to give some honest constructive criticism
keep up the good work.
Offline