I think some users will want to theme the mod. So here's some of the necessary code and image to do so.

.ccc-inner h2,
.ccc-expand {
	background-color: #D6C68F !important;
}
	
.ccc-outer,
.ccc-inner .ccc-accept {
	border: none !important;
}
	
.ccc-inner .ccc-accept {
	background: #5B4D2D !important;
	box-shadow: none !important;
}
	
.ccc-inner .ccc-accept:hover,
.ccc-expand:hover {
	background: #B7864B !important;
}
	
.ccc-inner a {
	color: #5B4D2D !important;
}

div#ccc-icon button {
	background:url(../images/cookiecontrol/cookie-control.png) no-repeat !important;
}

Hopefully this will save someone some time, firebugging the code. Obviously background image override is dependant on you having a images folder within your sub theme and within that a cookiecontrol folder and cookie-control.png (image attached) within that.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

authentictech’s picture

Title: Theming » Drupal themes override Cookie Control themes

The above CSS won't work for every theme. It depends on what rules are being overridden/inherited by the chosen Drupal theme. Skeleton, for example, has a lot of button theming that is not addressed by the above.

Also, Cookie Control has both dark and light themes, left and right positioning, which both need to be accounted for.

(Background info for other readers: This problem is happening because the style rules output by the module (from the cookieControl-4.1.min.js file) take lower precedence to style rules in Drupal themes.)

Could this be solved by adding !important to all the rules in cookieControl-4.1.min.js? If so, would the module maintainer be willing to do this? I have contacted CivicUK to ask them to do it as it is probably best done by them and I suppose, if it's a good idea, they would have no objection to it but it would depend on the module using the latest javascript code, unless they update older versions also.

In the meantime, on a personal note, I am finding it a real pain to get the pop-up to be styled correctly in all browsers. I have it looking just right in Firefox and Chrome but, as usual, IE7 is looking a mess. I am not a CSS guru so it's taking a while.

I am hoping there is an easier way out of this problem.

kingfisher64’s picture

FileSize
2.4 KB

https://groups.google.com/forum/#!topic/cookiecontrol/_3CM8NJFwd4 - I've requested the theming files, maybe it would help if someone else did as well.

Isn't the positioning issue just a case of float: left or right? it's not a styling or theming issue is it?

I've attached image called for so you can do a local override.

div#ccc-icon button {
background:url(../images/cookiecontrol/cookie-control.png) no-repeat !important;
}
authentictech’s picture

FileSize
14.41 KB

You're probably right about float positioning.

I am trying to keep the original colours.

I heard back from CivicUK who say they have updated their CSS selectors to improve specificity to fix this issue on Wordpress and other sites, so it would good to see what they have done and update the Drupal module.

Adding !important is probably not such a good idea as it will make it harder to override the theme as you have done.

I have found it useful to extract the CSS from the js file for easier reference. I have attached the file for others to use if they want (I can't guarantee I haven't introduced any errors, though, but I think it's accurate).

kingfisher64’s picture

FileSize
394.21 KB

Requested source file to override default branding colours. Was send psd by creator (attached)

authentictech’s picture

Now that I have fixed my styling issues in IE7, I am inclined to say the problem was caused more by my chosen parent theme than this module. Hence, I am not sure there is a module-based solution to this as I had hoped.

Any Drupal theme that aims for consistent styling will probably have some general style rules (like Skeleton has with buttons) and, by nature of how Drupal and CSS work, these may affect a module's theme. The only way to get around this is by overriding the styles you don't want in the local.css or subtheme, targeting specifically the module's elements.

In most cases this is probably not hard; in my case the Skeleton theme, which is a very nice looking theme, had a lot of general styles that were quite complex (at least I found them so).

Anyway, the solution is probably just to get good enough at CSS to do it!

Hence, I wouldn't object if this ticket were marked as "works as designed", unless anyone more knowledgeable than me has any better ideas. :-)

kingfisher64’s picture

Title: Drupal themes override Cookie Control themes » Drupal theming
FileSize
29.85 KB

I don't get why your having problems with the css? ccc is prefixed before every piece of css so any other classes from any other module / theme can't interfer.

Overriding css like this is far far from ideal, but it works. I've had no problems with the css (attached pic).

What would be an ideal solution is if civic came up with a create your own theme. Effectively a css stylesheet switcher.

authentictech’s picture

kingfisher64, the answer to your question is in my previous posts (i.e. Skeleton theme overriding the module theme) and I've now resolved it. I just had to get to grips with some rules of inheritance I either didn't fully understand or missed some pertinent rules in the Skeleton theme (which is quite complex by my standards). Then, although I did fix it quite quickly in Firefox and Chrome, something completely different was being output in IE7 (sometimes nothing at all!). So 95% of the problem was due to how IE7 handles (or doesn't handle) CSS.

I suspect overriding the module theme is much easier when creating your own Drupal theme or using a starter theme, rather than subtheming an existing Drupal theme.

Anyway, is there a reason why you changed the issue title back to a rather vague one (IMHO)? I don't think that title helps people know what this issue is about. "Drupal theming" could apply to any number of things and this is specifically about theming the module rather than Drupal. Could you possibly change it to something else more descriptive then if you think my edit was inaccurate (though I think I summed it up quite well). Thanks. :-)

kingfisher64’s picture

Title: Drupal theming » Overriding default theming

Yep, the reason is that you are not overriding cookie control theme with a drupal theme, so it kind of implies that there's a problem there while there isn't. You're right about it being too vague though, how about...

budda’s picture

Status: Active » Postponed (maintainer needs more info)

there is a template file in the module and you can override the default markup in your theme if you wish.
Or am i missing some other requirement here?

paulsheldrake’s picture

Can we have the css not be added by JS? It would be nicer if there was a separate css file that is just overridden in the theme layer like normal.

My custom css isn't getting picked up because of the inline css is taking precedent

Thanks

aken.niels@gmail.com’s picture

I agree with paulsheldrake, I think it's a terrible idea to implement styling through this minified JS file... It's a complete nightmare to make this module dance to your wishes. I'm having a lot of closed-source feelings when browsing through this JS file...

I'll be searching for another module to fix my problems, until this gets resolved.

micheas’s picture

If you are overriding inline css you have to use the !important argument in the css. However I don't think that will keep the js from overriding it.

budda’s picture

The minified JS is outside of the scope of this module. It's provided by another developer.