Hey everyone - I know that we're past API freeze, but I'm looking at possibly adding color.module support for Bartik, which we'd love to get into core. (See #683026 for that one.)
The changes I want wouldn't be revolutionary, but I'd love to get some feedback on getting these changes into color.module:
- Support for more than 5 colors.
- Support for custom names for those 5 colors, rather than the hardcoded 5: 'Base color', 'Link color', 'Header top', 'Header bottom', and 'Text color'
Then the question would become the following: if color.module could be modified to support this without breaking support for existing themes that use color.module, might this patch be considered for inclusion in D7 core?
(The one issue I could see would be that if Bartik goes in and it specifies more than the 5 labels, there would be a few new strings for translators.)
Let me know what you think!
Comment | File | Size | Author |
---|---|---|---|
#106 | color.patch | 1.04 KB | legolas8911 |
#102 | 693504-color.module-101-d6.patch | 19.45 KB | ELC |
#94 | drupal.color-js.94.patch | 1.06 KB | sun |
#88 | color-d6.patch | 18.71 KB | whoviz |
#86 | color-module-d6.patch | 18.34 KB | whoviz |
Comments
Comment #1
stephthegeek CreditAttribution: stephthegeek commentedColor.module has been such a long-neglected module because of these limitations. Simply expanding the number of colours allowed and the labelling would make it much more likely to be used by contrib themers.
There is this also module, which works fairly well, but hasn't really ended up in a stable state: http://drupal.org/project/color_soc08
Comment #2
mcrittenden CreditAttribution: mcrittenden commentedSub.
Comment #3
Dave ReidYeah I've wanted to add color.module integration to a module I was writing and it's impossible with how much hard-coding is going on.
Comment #4
stBorchertHere is an initial patch that makes color.module more flexible. You are now able to define which fields should be used (and which labels they have) in color.inc.
Next step is to make the gradient more flexible (allow more than one gradient, etc., ).
Happy testing.
Comment #5
ipwa CreditAttribution: ipwa commentedThis is amazing! I have a theme that sues the color module (dropshadow), and I always had been annoyed by the fact that the labels couldn't be changed. Thanks for your work here guys! Will test the patch and report back.
Comment #6
stBorchertHere is another version that refactors the gradients.
You are now able to have multiple gradients in your theme (vertical and horizontal!).
Unfortunately I couldn't really test horizontal gradients because of I do not have a theme that makes use of it (though it should work; hopefully).
Comment #7
ipwa CreditAttribution: ipwa commentedI confirm this worked well. I changed the labels defined in Garland's color.inc, and added a custom field for which I added a hex value in some of the color schemes. I didn't have any problems. I would love for this patch, after its tested by more people, to go in. The changes are nothing drastic and is something that would be so beneficial to themers who don't really get the color module, I could definitely see a lot more themes with nice color schemes come out if this went through.
I would love to use this version of the module when porting my dropshadow theme to Drupal 7, because one of the things that let me down when working on the 2.x branch is that I couldn't rename the labels without hacking core. That coupled with problems using the base color field because it was so heavily tied with Garland, that I couldn't get it to work very well (wouldn't save the exact colors I picked), led me to slow my work on that branch and never come up with a beta release.
This issue should probably be also tagged with: Bartik, and D7 theme.
I will try to quickly port the 2.x branch of Dropshadow to d7(with this patch) and see if I have the same problem I had with base color as I did in d6.
This is a screenshot of the patch in action:
http://img.skitch.com/20100124-rxia8u83j6etijux9ui3xk48g7.png
Comment #8
stBorchertA little bit of documentation:
The "fields" array *must* contain the keys "base", "link" and "text". All other items are optional.
If you define a new scheme, you only have to add the color keys that are different from "default" because it is merged with the values of scheme "default".
A definition of the following code in color.inc
will result in
for scheme "test".
Comment #9
Nick Lewis CreditAttribution: Nick Lewis commentedJust noting that this feature supports #695292: Add new theme to core: Busy (and therefore I think an exception could me made in adding new features while in alpha)
Comment #10
ipwa CreditAttribution: ipwa commentedThis feature also supports #683026: Add a new theme to D7 core: Bartik
Please make an exception for this! Drupal 7 really deserves a more flexible color module!
Comment #11
mcrittenden CreditAttribution: mcrittenden commentedBefore I forget:
That line's using a tab instead of spaces.
Comment #12
joachim CreditAttribution: joachim commented+1 for inclusion in D7.
Tested the patch; while I don't have a theme to try it on, the existing features of color module all seem to work fine on Garland. In other words: this doesn't break existing stuff :D
Comment #13
theresaanna CreditAttribution: theresaanna commentedThis patch totally breaks for me with Bartik. When I go into Bartik settings I get an empty overlay as seen in the attached screenshot. It does work with Garland, though.
When I go back to the List overlay, I see in $messages:
* Notice: Undefined index: default in color_scheme_form() (line 151 of /Users/theresasumma/Repositories/d7/modules/color/color.module).
* Notice: Undefined index: default in color_scheme_form() (line 151 of /Users/theresasumma/Repositories/d7/modules/color/color.module).
* Notice: Undefined index: default in color_scheme_form() (line 151 of /Users/theresasumma/Repositories/d7/modules/color/color.module).
* Notice: Undefined index: default in color_scheme_form() (line 151 of /Users/theresasumma/Repositories/d7/modules/color/color.module).
Comment #14
theresaanna CreditAttribution: theresaanna commentedEven if we didn't get flexible color names, I would love to see support for a link hover color, content section header color, block header color. Just those would make a huge difference!
Comment #15
stBorchert@theresaanna It couldn't work with Bartik (or better: Bartik won't work with the patched version of color.module for now) since it uses a completely new (and different) syntax for defining schemes and gradients.
Therefore "old-style" color.inc implementations do not work with the patched color.module.
Comment #16
joachim CreditAttribution: joachim commentedHere's a perl script that helps convert old-style colour schemes from color.inc to a new array with key names.
To use it, run it in your theme folder. It will print out the new format for the 'schemes' key, which you can then use in your color.inc file.
Comment #17
seutje CreditAttribution: seutje commentedcool, subscribe!
Comment #18
dixon_I've updated this patch with some minor code style changes. I also tested the patch and it works fine with Garland (which is the only theme in core that supports the color module).
Comment #19
dmitrig01 CreditAttribution: dmitrig01 commentedI seriously doubt this can get into D7.
Comment #20
jensimmons CreditAttribution: jensimmons commented(Adding the tag Bartik, so we can keep an eye on this in that tag list.)
Comment #21
dixon_@dmitrig01 I agree this is an API change. Although, it's a very minor one that only touches one core theme at this moment (Garland). It also removes some very ugly hard coded - Garland specific - stuff.
So it is for a very good reason, imho. The state of color module in D6 and currently in D7 is almost unusable for other themes like Bartik, with fixed labels etc.
If this won't change, the color module support for Bartik won't happen, I think.
Comment #22
JohnAlbinIMO, color module is so flawed, before we release D7, we should:
Comment #23
stBorchert@John "fix the ridiculously garland-specific hard-coded things about the API (i.e. the label and the 5 color thing)"
This is done by the patch I posted.
You are now able to have more than 5 colors (at least "base", "link" and "text" are required) and you can have different gradients on the site (though I couldn't really test that feature).
Comment #24
tonyn CreditAttribution: tonyn commentedHey guys. I'd love to help. Been a while since I've been in the issues. :)
I'd be happy to help out anyway possible to tweak D7's color module for our new default theme(s).
Yeah, I understand it's a little late, but perhaps we can slip it in as a theme-centric type patch. Like reconciliation in senate :D
Comment #25
migueltrindade CreditAttribution: migueltrindade commented#4: 693504-color_module-custom_fields-4.patch queued for re-testing.
Comment #26
eigentor CreditAttribution: eigentor commentedWhat I need to do in busy is create gradients with diagonal direction (this is fine with doing them by overlaying a semi-transparent png over the background color).
But here comes the trick: I need to do it in different colors, since in this one http://drupal.org/files/issues/busy-red-1.jpg The gradient for the footer must be created in blue, and the one for the sidebar on the right side in red.
If it is just too hard to do or impossible or too much effort I may back down to regular vertical gradients that can be done with the gradient tool. But not yet... For the PNGs allow for all kinds of crazy (one-color) gradients other themes can also make use of.
I wonder if this can be made possible.
Comment #27
webchickIf we apply normal rules, which we generally should, this patch gets bumped to Drupal 8 as a new feature.
However... I can plainly see by reading the patch that the current Color module was only intended to ever work with Garland, and that's making it hell for these new core themes to use. And even though Color module has been part of Drupal core since version 5, so the current situation cannot be classified as a regression, it wasn't until right now that we actually started trying to add functionality that took advantage of this API elsewhere in core.
I think I'm willing to grant an extremely limited exemption to this patch, assuming that Dries doesn't overrule (which would be perfectly sane to do so). And by that I mean keep it to only fixing the clear and obvious "bugs" in the API that make hard-coded assumptions about Garland and make it work for other themes, not going totally bananas and making Awesome Color Module With Kittens And Ponies And Yay!
Deal?
Comment #28
stBorchertDeal!
Ok, lets sum up what we need to fix:
- fields that defines colors are hardcoded in color.module and color.js
- only one gradient can be set
This is all fixed with the patch.
Did I forgot something (or added to much)?
Comment #29
RobLoachOh, I'm liking this!
Comment #30
dmitrig01 CreditAttribution: dmitrig01 commentedDon't use one-character variable names.
You can combine this into one statement.
var schemes = settings.color.schemes, colorscheme = this.options[this.selectedIndex].value;
Also, use camelCase for variables in JavaScript
Again, don't use single-character variable names.
I would rather use 'type' => 'vertical' or 'type' => 'horizontal'
What about all subsequent gradients? shouldn't it be .gradient or something?
Powered by Dreditor.
Comment #31
stBorchertOk, I've changed the coding according to Dmitris notes.
Except for "What about all subsequent gradients? shouldn't it be .gradient or something?". This is a theme specific selector that could be totally different in other themes (and is surely different if you are using a horizontal gradient).
Comment #32
dawehnerA comment would be cool, what this code does.
Powered by Dreditor.
Comment #33
stBorchertHere you are.
Comment #34
joachim CreditAttribution: joachim commentedDivided.... :)
I'm on crack. Are you, too?
Comment #35
stBorchertUps. Corrected.
Comment #36
EclipseGc CreditAttribution: EclipseGc commentedSo, I'm trying to make the busy theme candidate color enabled, and these changes would be HUGE towards making that possible. I'll try out the patch tomorrow hopefully and reply back, but base on having dug around in color's guts some already, these changes look very sane.
Comment #37
Jarek Foksa CreditAttribution: Jarek Foksa commentedChanging names for "top" and "bottom" and adding more colors works fine. I will do more tests later this day.
Comment #38
Jarek Foksa CreditAttribution: Jarek Foksa commentedIf I set base color for default color scheme in color.inc to be exactly the same as in style.css I'm getting "Undefined index: base in _color_rewrite_stylesheet()" error when switching schemes in admin panel. But if base color is slightly different than in style.css (e.g. #f0f8fe instead of #f0f8ff) everything works correctly.
I have attached minimal theme which demonstrates this issue.
Comment #39
eigentor CreditAttribution: eigentor commentedWhat comes through is that color module needs to support any sort of CSS selectors to be recolored: say you want all h3, #content a and .node h2 elements to have the same color - this must be possible.
Else you get always tripped by two elements having by chance the same color in the default color scheme and you cannot seperate them out in a clean way. How I understand the module at the moment is it picks elements depending on the area on the site and apart from that by color name, regardless of semantic circumstances.
To keep it easy, it might be possible to just override color names, but set a selector of say #content h2 to have greater weight than that. Thus you can keep the handy ability that the module picks any color name from the css - if you do not adress the selectors more precisely.
Comment #40
Jarek Foksa CreditAttribution: Jarek Foksa commented@eigentor Alternative solution that comes to my mind would be using PHP variables in CSS files. E.g. you could define values for $page_background variable in color.inc for each color scheme and then use this variable throughout all stylesheets like this:
But that would make an "awesome Color Module With Kittens And Ponies And Yay!".
Comment #41
eigentor CreditAttribution: eigentor commentedWhen I thought about it some more, it came to me that my idea does not really work.
I guess Color Module does simple string replacements and thus can only replace color names.
For someone creating color styles there is a simple Trick: One could differentiate the colors by giving say #FF8800 to .block h2 and #FF8801 to .node h2. This way one always keeps theme seperate.
More important would be what the title of this issue implies: supporting more than 5 colors and giving custom names to them.
Comment #42
jibninjas CreditAttribution: jibninjas commentedI just cannot get this to work. I am not sure what I am doing incorrectly. I have tried applying a couple different patches that are supposed to add the custom fields and and they just don't show up. I have tried this in Garland and in Pixture_Reloaded. Nothing in either.
Any thoughts on what I could be doing wrong? I mean, it is not that it won't work properly, but that the field just doesn't show up. Thanks
Comment #43
Jarek Foksa CreditAttribution: Jarek Foksa commented@jibninjas Are you sure that you have enabled color module in admin panel? It's disabled by default. Also note that you have to initialize it in template.php file (should be already done in Garland).
Comment #44
jibninjas CreditAttribution: jibninjas commentedYes, both of those things have been done. I have already been using the color module in the pixture_reloaded theme but wanted to add in a couple new fields. But no matter what I do only the 5 standard fields show up.
Also, looking when applying the patch there were numerous things that were not where they should be. The lines that it said to edit rarely matched up with the line it was really on. Also I really could not find a perfect match to
Comment #45
jibninjas CreditAttribution: jibninjas commentedWell, it looks like this is only for D7 and I was trying to get it to work with D6. Does anyone know if you can use the color.module from D7 in D6? Or if there is another patch for D6 that accomplishes the same thing?
Comment #46
joachim CreditAttribution: joachim commented> Or if there is another patch for D6 that accomplishes the same thing?
There isn't, and there probably won't be as it would break D6 themes that depend on color module.
What you could do instead is write an alternative color module as a D6 contrib module and let themes use that if they wish to. But that's outside the scope of this issue.
Comment #47
jibninjas CreditAttribution: jibninjas commentedI would love to write a contributed module to accomplish this. But unfortunately I am just not that good. I know a little php and suck at javascript, so it would be pretty difficult for me.
Comment #48
stBorchert@jibninjas: try Color.module TNG.
Comment #49
Jarek Foksa CreditAttribution: Jarek Foksa commentedColors in admin panel are sorted very chaotically, I can't find a pattern. It would make sense to preserve the same order as in color.inc file or at least sort them alphabetically.
Comment #50
dcrocks CreditAttribution: dcrocks commentedAfter applying 693504-color_module-custom_fields-35.patch i get a blank page when selecting 'settings for bartik on appearance page. After re-selecting 'appearance'
# Notice: Undefined index: default in color_scheme_form() (line 151 of /Library/WebServer/Documents/testcms/modules/color/color.module).
# Notice: Undefined index: default in color_scheme_form() (line 151 of /Library/WebServer/Documents/testcms/modules/color/color.module).
# Notice: Undefined index: default in color_scheme_form() (line 151 of /Library/WebServer/Documents/testcms/modules/color/color.module).
# Notice: Undefined index: default in color_scheme_form() (line 151 of /Library/WebServer/Documents/testcms/modules/color/color.module).
# Notice: Undefined index: default in color_scheme_form() (line 151 of /Library/WebServer/Documents/testcms/modules/color/color.module). 7-alpha1 with bartik downloaded from git. Garland color selection works OK.
Oops. Sorry for duplicate. I saw #39 but not #13 so thought mine was different.
Comment #51
stBorchert@dcrocks: I guess bartik doesn't builds upon the patched version of color.module so I wouldn't expect this to work.
Comment #52
dcrocks CreditAttribution: dcrocks commentedIt appears the array structure for 'schemes' and 'gradients' in color.inc has changed, I don't know if after the patch or before. I made corresponding changes from Garland's color.inc to bartik's color.inc and it appears to work. I assumed the array of colors in the current bartik file corresponded to (base,link,top,bottom,text). Is there a current demo ssite where I can check to see if I screwed up the layoit?
I am new to drupal and don't know how to build patches, never mind testing them. I am playing with several of the 'proposed' core themes for ver 7 and am trying to learn by seeing how they operate, so the color problem with bartik intrigued me.
Comment #53
stBorchertAt them moment there is no theme build upon the patched version ot color.module (except for garland, which is modified by this patch too).
So you have to manually edit color.inc of bartik to match the new structure.
Bartik and Busy will be using the changes made to color.module if they will be committed. Otherwise it has to wait until D8.
Comment #54
joachim CreditAttribution: joachim commentedSince Bartik is being developed on Git, we could start a branch there in ancitipation of this patch getting in -- that would give us a second theme to play with.
Comment #55
dcrocks CreditAttribution: dcrocks commentedI understand change has to end somewhere, but it doesn't look difficult for individuals to make their own changes if they like this. Still a lot I don't understand about this module yet. But the color picker is neat to play with. Am also trying to understand role of color.css file in bartik. Drupal has so many logical overlays and confusing documentation it would be nice if every file would carry a purpose and impact statement embedded.
Comment #56
Jarek Foksa CreditAttribution: Jarek Foksa commentedI've found another two issues:
- colors other than "base", "link" and "text" are not shifted on preview page.
- overwriting theme_color_scheme_form($variables) does not work
Comment #57
Jarek Foksa CreditAttribution: Jarek Foksa commentedCorolla theme now supports patched color module.
Comment #58
Cyberwolf CreditAttribution: Cyberwolf commentedSubscribing.
Comment #59
Jarek Foksa CreditAttribution: Jarek Foksa commentedI have ported my theme back to standard, unpatched version of color module and it has the same issues:
- "Notice: Undefined index: base" errors appear if base color value specified in color.inc is exactly the same as in stylesheets
- overwritting theme_color_scheme_form() does not work
- color preview does not show "Header top" and "Header bottom" colors
So this patch does not really introduce any new bugs, though the color module is so flawed that it would make more sense to remove it altogether and use subthemes or stylesheet switching instead.
Comment #60
jensimmons CreditAttribution: jensimmons commentedWhat's the status of this?
dcrocks created a txt file with proposed changes to Bartik, to help it match the work going on here. #749276: Alter Bartik to run with the modified color module (from #693504)
dcrocks also said above:
This is why we made color.css:
When you use color module, it duplicates the stylesheet where the colors live, and takes the duplicate and hides it away in color module world. It also hijacks the theme, and points the theme to the new hidden copy of the stylesheet, disabling the original copy.
When the color styles are in styles.css, this hijacking means that the original styles.css file is totally disabled. And changes that anyone subsequently makes to styles.css don't work.
Since we know people like to take core themes, duplicate them and hack them into submission, letting color module disable styles.css is a recipe for frustration. By putting color module styles in a file be themselves, all color module hijacks is control of the color. All the other styles remain unaffected and available for changing.
Comment #61
sunLooks like this issue got derailed with unrelated stuff and no one really reviewed.
So here's my initial review. Note that I have tried to remain as ignorant as possible as to what's been going on in this issue, so that I can give it a totally fresh set of eyes. Apologies if any of this was already mentioned above. Also, I didn't actually test this patch, deferring that to others.
Missing var here.
Double id selectors like this usually don't make sense. IDs are unique, by nature. :)
Missing var for j here.
Ditto (var).
callback() (what a *ugly* function name! :P) gets a jQuery object in 'input' already. Therefore, input should be renamed to $input - which would have prevented the double-and-triple invocation of $() here.
I don't see height or width being defined in this function...?
Would be good to fetch variable_get() into a local variable first (and once).
Strange indentation here.
Same as above mentioned for JS -- ids are unique.
Of course, to prevent name clashes, all of these ids should be namespaced with "color-" in reality, but that's a separate issue.
Powered by Dreditor.
Comment #62
joachim CreditAttribution: joachim commented> Double id selectors like this usually don't make sense. IDs are unique, by nature. :)
A selector of "#foo #bar" can make sense. It means "only select id bar when it happens to be inside id foo". In other words, only select #gradient-i when it is in a #preview.
That said, I've no idea if this is necessary -- if this jQuery is only being loaded when #gradient-i is in #preview anyway.
Comment #63
eigentor CreditAttribution: eigentor commentedThe patched version works quite well.
One thing is bugging me though: whatever pre-defined Color Set I choose, the dropdown always says "Custom" after saving.
Here is my complete color.inc file for debugging:
Comment #64
ksenzeeAttached patch fixes the problem eigentor noticed, and addresses sun's point in #61 about using variable_get just once. I didn't have time to get to the javascript, so I'm leaving this at "needs work."
Comment #65
sun@ksenzee: The patch you uploaded has 0 bytes.
Comment #66
EvanDonovan CreditAttribution: EvanDonovan commentedIs there still a chance to get this in? It seems like it would be cool to make Color module more flexible. I didn't realize you were so limited in the number of colors you can pick.
If this issue can still make it into D7, is the current status that the patch from #35 needs to be updated to reflect sun's code review from #61, and eigentor's testing in #63?
Comment #67
Jarek Foksa CreditAttribution: Jarek Foksa commented#66 Yes, the patched color module is working fine (with minor issue pointed by eigentor), so after code style issues are resolved we could set status to RTBC.
It would be nice to see a follow-up patch that fixes (or completely removes) extremely garlandic color preview code.
Comment #68
ksenzeeNow! With more bytes! Wonder what happened to the upload.
With this patch, the current status is that we need to resolve sun's remaining concerns, and the ones I will find when I finish reviewing. :) I checked with webchick and it sounds like this can still go in. I'm setting to needs review for testbot.
Comment #69
EvanDonovan CreditAttribution: EvanDonovan commentedksenzee:
Thanks for the patch. I tested it in Garland, and all the default color schemes worked. I was also able to create a color scheme of my own.
Got to get on with the rest of my day, but hopefully, I'll be able to test with Bartik sometime this weekend (using patch from #749276: Alter Bartik to run with the modified color module (from #693504)).
Is there anything else I should test? I wish I could test what it actually fixes, but only the patch for Bartik actually is coded to support this.
Comment #70
EvanDonovan CreditAttribution: EvanDonovan commentedForgot to mention something important: when I first went to the Garland settings, it said I was in a Custom theme, even though it was the Default (Blue Lagoon). So there's some logic that needs to be fixed there.
Comment #71
EvanDonovan CreditAttribution: EvanDonovan commentedI tested this patch with the patch I rolled on #749276: Alter Bartik to run with the modified color module (from #693504). Works great! (Can't remember if it had that same issue about starting out with Custom selected, though).
Comment #72
EvanDonovan CreditAttribution: EvanDonovan commentedJust tested with Corolla: http://drupal.org/project/corolla & it works on there also. Too bad that Corolla probably won't make it into Drupal 7 core - it is a very clean-looking theme.
Comment #73
Jarek Foksa CreditAttribution: Jarek Foksa commented<offtopic>
@EvanDonovan if you know of any issues that would prevent Corolla from getting into core then please report them on project's issue queue. I will do my best to fix them as soon as possible.
</offtopic>
Comment #74
dcrocks CreditAttribution: dcrocks commentedThere are still problems -rtl stylesheets. I know this is discussed elsewhere but they seem to be inactive issues. The fix in the color module will only work for the garland theme. The fix says:
if there is a $stylesheet-rtl.css in the same directory as $stylesheet.css, then also write out a new $stylesheet-rtl.css file to have color mods applied.
That is, if I read the code right.
Comment #75
ksenzeeI believe this is ready now. Attaching an interdiff so it's easy to see changes from the last patch. I went through the JS and changed the absolute minimum of what I could stand to change - fixing variable declarations, basically.
Comment #76
ksenzeeForgot to mention I also tested the HEAD-HEAD upgrade path and it's fine. I can't speak for the D6-D7 upgrade path, but if it worked before it still works. :)
Comment #78
ksenzeeOops, forgot to name my interdiff such that the bot would leave it alone. Here's the same patch again for the bot's benefit.
Comment #79
jensimmons CreditAttribution: jensimmons commentedI tried this out, and nothing exploded. That's always good.
I patched D7, and I patch Bartik with http://drupal.org/node/749276#comment-2800512.
Testing out changing colors in Bartik works just fine.
Comment #80
EvanDonovan CreditAttribution: EvanDonovan commentedPatch applied, and worked correctly on Garland (i.e., no issues with the "Custom" text). It also worked correctly on Bartik with the patch I re-rolled on #749276: Alter Bartik to run with the modified color module (from #693504). Finally, it worked on Corolla, which already had been modified for it.
So, should be good to go!
Comment #81
ksenzeewebchick pointed out that there are no tests in this patch. After I forgave her for noticing, I whipped one up. Only difference between this and the last patch is the .test hunk.
Comment #82
webchickExcellent. Great work on this, all!
Honestly, code-wise there's not really anything to complain about. A bunch of difficult to read code got comments and split from comma-separated lines of color to named arrays, etc. I did ask for the test because when doing this kind of refactoring you want to make sure you cover it. The new test is basically just a copy/paste of the other test so although there are some things I'd change about it (more comments, etc.) it would create inconsistency with the existing one.
Therefore........ Committed to HEAD! :D
Hope I come back from Vancouver with lots of lovely Color module-enabled core themes. ;)
Comment #83
EvanDonovan CreditAttribution: EvanDonovan commentedHuge thanks to ksenzee, webchick and all who helped on this issue. Time to take myself over to #749276: Alter Bartik to run with the modified color module (from #693504) & related issues :)
Comment #84
andypostIs there any docs about changes?
Comment #85
sunHmmm.
Missing var for 'j' ?
Missing var for i and j here (separate function).
I still don't see height being defined in the preview() function.
callback() still gets a jQuery object for input. input should therefore be renamed to $input, so as to prevent needless $() calls.
Powered by Dreditor.
Comment #86
whoviz CreditAttribution: whoviz commentedAs I want this feature in D6, I tried adapting the last patch. Garland's presets seem to work fine upon save, but the js is broken (the hex fields don't update and the preview doesn't work). I'm attaching the patch if anyone wants to have a look.
Comment #87
whoviz CreditAttribution: whoviz commentedSorry, didn't mean to change the status.
Comment #88
whoviz CreditAttribution: whoviz commentedGot it working for D6 (although it doesn't take into account comments in #85). Thanks for your work ksenzee!
Comment #89
andypostSuppose better to make color2 contrib module to backport this changes and provide a upgrade path if this is needed
EDIT: maybe integrate this changes with http://drupal.org/project/color_soc08
EDIT2: issue #761322: Need for this in D7 now & should this be refactored to reflect D7 version?
Comment #90
EvanDonovan CreditAttribution: EvanDonovan commented@whoviz @andypost:
Excellent idea. color_soc08 is kind of an awkward name for a project, though, in my opinion.
Can further discussion of that happen in a separate issue? Let's keep this one focused on any cleanup that needs to be done after the D7 patch having been committed.
Comment #91
EvanDonovan CreditAttribution: EvanDonovan commentedI have filed #761322: Need for this in D7 now & should this be refactored to reflect D7 version? against color_soc08. Perhaps, whoviz, you could post your D6 patch in there, so we could keep this issue for the D7 followups.
Comment #92
Jarek Foksa CreditAttribution: Jarek Foksa commentedI have just added another theme that uses patched color module.
Comment #93
ksenzeeThis is not the right place to discuss general JS cleanup for color.module such as sun is suggesting in #85. JS does not have block scope, so it's incorrect to redefine in an inner function a variable such as j that has already been defined in the outer function. Ideally you wouldn't reuse such a counter variable in an inner function. Even more ideally, you wouldn't create unneeded closures, which this module does with abandon (as indeed does much of Drupal's JS, but color.module is particularly fond of them). But like I said, that's a separate issue, and one I would happily review.
Comment #94
sunThat's true, to some extent. Wasn't aware of that messy code, sorry. But anyway, this patch introduced a global variable.
Comment #95
ksenzeeThat j has been global since http://drupal.org/node/88202#comment-455697, which is egregious enough of an error that it's worth fixing here even if it is the wrong issue. Looking forward to that color.js cleanup patch, hint hint. :)
Comment #96
EvanDonovan CreditAttribution: EvanDonovan commentedSo looks like sun's patch fixes the scope of the j, which is good. ksenzee: I never saw the issue that put Garland in core before, so thanks for that. I hadn't even heard of Drupal at that time :)
Comment #97
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #98
eigentor CreditAttribution: eigentor commentedThe patches appear to have introduced a new bug: #769922: Color module never loads styles directly from theme directory
I guess this is not intended. Don't know if it is Sun's or ksenzees patch or if those simply don't work with D7 alpha 3.
Comment #99
eigentor CreditAttribution: eigentor commentedJust posting any new color module issues here, as this place may serve as a meta issue: #772106: Color Module: Impossible to use a defined color twice in filling for background images
Not sure if this is an old bug that has always been there, or if it is new.
Comment #102
ELC CreditAttribution: ELC commentedThe D6 patch no longer works again 6.22, so this is the exact same patch re-factored to work against that, but including the changed from #85 (I really don't know what I'm doing re: $(input) part)
How do we get this committed to Drupal 6 HEAD? Having to patch it all the time to get things to stay working is a PITA. We use a number of fully color supported themes for ease of management.
I am still getting an error with farbtastic.js when swapping between presets in either Garland or my own theme. This seems to be new for 6.22 as it worked fine in 6.20.
Perhaps I should open this up as a D6 color.module dedicated issue.
Comment #103
webchickFixing version/status.
Comment #104
gabrielu CreditAttribution: gabrielu commentedDoes this ever got into core? I am trying to use custom colors in D7 and no luck? Is it working for D6 out of the box, or not?
Comment #105
RobLoachIt's in Drupal 7, but not in 6.... Unsubscribe.
Comment #106
legolas8911 CreditAttribution: legolas8911 commentedI've made a patch for Drupal 7 to accept and work with multiple colors.
Comment #107
EvanDonovan CreditAttribution: EvanDonovan commentedYou can have multiple colors already in Bartik and other supported themes in 7.x...Unsubscribe.
Comment #108
legolas8911 CreditAttribution: legolas8911 commentedMaybe, but I was working with a Zen subtheme.
Comment #109
ELC CreditAttribution: ELC commentederr .. this functionality has been in D7 for a while now. Currently trying to get those changed fixed up enough to be back ported into D6 which is what the patch in http://drupal.org/node/693504#comment-4970060 is for. I've got it most of the way except for the javascript being a little bung, and I do not know how to fix that.
There's no need to patch core to get this to work with a zen sub-theme. I have it working without just fine.
What exactly does your patch do as it seems to be screwing the 'base' colour? Perhaps you should open it as a separate issue as this is specifically dealing with the limitations of the hard coded colours in the color.module.
Comment #110
ELC CreditAttribution: ELC commentedReturning this to 'needs work' since that's what it needs. Still no idea what the patch in #106 does except for breaking base colour vectors.
Any javascript gurus out there? Javascript debugging isn't even a suit I wear.
Comment #111
legolas8911 CreditAttribution: legolas8911 commentedMaybe I wasn't very explicit in my problem. I had to make color module change just CSS colors. I didn't need overlays and so on. Just defining other colors, ~ 15, and have the ability to change them from the admin panel. With the default color module, it displayed only 5 colors, or in some cases, displayed them all, but didn't changed the css color only on the first 5. With my patch, I can do that without a problem.
Comment #112
jensimmons CreditAttribution: jensimmons commentedJust to clarify what's happening in this thread: When creating Bartik for Drupal 7, I wanted to be able to implement more colors (with their own labels) using color module. In Drupal 6 (and 5) there's a limit of 5 colors, and the labels are hardcoded. We accomplished that goal — and Drupal 7 allows any theme to define colors that will be changeable with color module, as many as you want with whatever labels you want. It's done.
It looks like people have recently requested that this change to color module be back ported to Drupal 6. I highly doubt that will happen. In fact, I could perhaps say there is no way this is going to happen. Drupal 6 APIs are locked and have been for years. This kind of change is not allowed.
In fact, we were lucky to be allowed to change this for Drupal 7 almost two years ago, because even in early 2010, we were very late in the D7 development cycle. Steven Merrill (who did much of this work) had lots of ideas about how to seriously revise color module while he was in the code looking around, but we did not even try to implement those ideas for Drupal 7 because it was too late to make heavy alterations. Those kinds of ideas can be implemented in Drupal 8 (and not back ported to Drupal 7).
Any discussion about ideas of how to alter colors in a Drupal 6 theme should happen in other discussion threads. Perhaps you can make a contrib module that people can download and use with their Drupal 6 website. Or if you need this for D6, you'll have to just keep patching your copy of D6. The official version will be staying as is.