Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


color codes ...

 
Post new topic   Reply to topic    Cacti Forum Index -> Help: Unstable Development Versions
Author Message
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Fri Dec 29, 2006 1:41 pm    Post subject: color codes ... Reply with quote

I'm currently on the way writing some Aggregate Plugin (I may have told already ...). One of the biggest problems is the (sorry) awful color table. If it were sorted like given by http://forums.cacti.net/viewtopic.php?t=6308&highlight=colors, it would be much better.
  • color assignment during template development would be much easier
  • arithmetic increasing of color codes would be easy for my new plugin
  • "fire effects" would be much easier


So I'm on the way to implement the second approach posted in the thread linked above. It's a very nice color table and should be "internet safe" (whatever this would be ...)

I thougth this would be easy doing. My approach was to rename the old table and import the new one. The I wanted to update all color codes used by templates and graphs by matching the id's via their hex codes
Code:
UPDATE .... SET color_id = colors.id... WHERE colors.hex = colors_old.hex;
or the like. Unfortunately, the "old" color set does not match the new one.
And a simple replacement of the old color table by the new one would scramble all colors; you won't like that, I suppose.

So I'm on the run with the next approach. But I'd like to hear your comments, as it will be a bit more trouble (at least for me as a "skilled" php programmer ). Let me tell you:

  • change sorting as stated in the post above (this will require a tiny little code patch)
  • write some php module to perform
  • rename colors table to colors_old
  • insert new colors table
  • create a "comparison screen" that tries to match each "old color code" to a new one using a "minimum color distance algorithm". Allow the user to select a different match if she/he likes to. Allow for "Cancel" or "Save"
  • when saved, change all references to a colors_old.id to the corrensponding new colors.id, be it from graph templates or from graph_items


I hope that's all. Personally, for me a less expensive approach would be fine. But I suppose, there's a need to get a new color schema sooner or later. And that would need some conversion code.
So I'll volunteer to accept ideas to go this way. If nobody is interested, I'll do it on my own.

So, please let me hear your ideas

Reinhard
Back to top
dk10tlx



Joined: 04 Aug 2007
Posts: 19
Location: Tirol / Austria

PostPosted: Sat Aug 18, 2007 8:02 am    Post subject: Reply with quote

Hi Reinhard,

what's the current state of your development on the colourtables? Is there still help needed? Let me know.
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Sat Aug 18, 2007 2:31 pm    Post subject: Reply with quote

Hi,
to be honest, I dropped it. While I still assume it would be a good idea, other stuff like moderation, documentation, testing upcomin cacti release and a tiny bit of coding kept me away from it.
What's your opinion on this matter?
Reinhard
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9696
Location: MI, USA

PostPosted: Tue Sep 04, 2007 6:03 am    Post subject: Reply with quote

I suggest that we do a few things, in the form of an upgrade:

    1 - Backup the old color table.
    2 - Create the new color table based upon the recommendations from other posters.
    3 - Convert all user graph templates and static graphs to utilize the legacy colors from the new color table.
    4 - Create a dropdown option in Graph Templates to that would allow all Imported Templates to be migrated to the new color tables.
    5 - Modify the Drop Color to Utilize the New Sort Order


This combination of options would do it for me. If you want to help, you will write this up by making the changes in the following locations:

graph_templates.php
lib/html_form.php
install/0_8_6j_to_0_8_7.php

TheWitness
Back to top
sh0x



Joined: 30 Aug 2007
Posts: 14

PostPosted: Wed Sep 05, 2007 1:13 pm    Post subject: Sort order (hex to ID) Reply with quote

Hi,

I loaded the WWW safe colors from http://forums.cacti.net/viewtopic.php?t=6308&highlight=colors.

However, I can't figure out how to change the sort order from HEX to ID. I have the aggregate plugin loaded. I

changed color.php to:
$color_list = db_fetch_assoc("select * from colors order by id");

..but I can't find the other file, html_form.php, to make the change there. I'm not sure if I have different cacti version from that post or if the aggregate plugin changed this.

Can you help me adjust the color sort order from HEX to ID in cacti 0.8.6j with aggregate plugin loaded?

Looking for to the latest official Cacti release next week!
Back to top
sh0x



Joined: 30 Aug 2007
Posts: 14

PostPosted: Wed Sep 05, 2007 1:18 pm    Post subject: Reply with quote

I imported the colors from the other post and re-ordered the list and it works great.

Looking forward to the latest official Cacti release next week!
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Wed Sep 05, 2007 1:39 pm    Post subject: Re: Sort order (hex to ID) Reply with quote

[quote="sh0x"...the WWW safe colors from http://forums.cacti.net/viewtopic.php?t=6308&highlight=colors. [/quote]Yep, I know this post. IMHO, this is NOT the web save color set. My favourite resource on this topic would be http://en.wikipedia.org/wiki/Web_colors, at least for a start. To not read to many links, you will spend too much time ...
Reinhard
Back to top
psyber



Joined: 02 Aug 2005
Posts: 46

PostPosted: Tue Mar 04, 2008 10:13 pm    Post subject: Reply with quote

Has this progressed any further? I'd like to move this along a bit but need to know the finalized color list.
Also I 'm not so sure you need to tie yourself down to the 216 colors that are web-safe, most modern browsers handle color pretty well. The major reasons for web-safe were dithering when the desktop was set to 256 color and how browsers rendered the color called out in html. I know at one point IE had a color issue with PNG but I'm pretty sure that has been addressed. Either way you may want to consider the 4096 web-smart colors which includes the 216 color web-safe pallet.
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Wed Mar 05, 2008 7:57 am    Post subject: Reply with quote

Sure. But I was under the impression, that the number of 216 colors would be enough. And scrolling through a list of 4000 elements when assigning colors perhaps does not make fun to most of us.
Still, I do not know a real good, non-manual method to map "old colors" to "new colors" to support a migration from the current color scheme to any new oine
Reinhard
Back to top
psyber



Joined: 02 Aug 2005
Posts: 46

PostPosted: Wed Mar 05, 2008 10:48 am    Post subject: Reply with quote

What if you added the new scheme to the existing one and reverse sorted it leaving plenty of room between the old and the new and add colors after the old.
1-106 existing colors
1000-? new colors
107-999 user defined
sort high to low

That way you don't step on any original or user defined color so you don't break any existing templates and you get the sorted colors.


Or (I like this better) you could store the actual color in the graph_template_item (maybe other places too) instead of the color_id and use a javascript color picker like this < http://www.allscoop.com/tools/Web-Colors/web-colors.php >
you can leave the existing color table in place so as not to break any plugins that use it. A SQL command can back fill the hex values in existing templates.
Cons:
This will break existing templates unless you create a bit of logic to convert color_id to appropriate hex and and replace it during the import. Probably not a minor revision. Changing a color will then only affect the graph you change it on and not globally (this might be a Pro as it depends on how you want that to work)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: Unstable Development Versions All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group