Currently I'm only able to create custom styles by changing the existing styles (and leaving them titled 'example1' etc).
This is not really nice, it would be better if I could just create my own style with its own descriptive name.

I've attached a patch that implements this. Instead of using the fixed lists of styles it also scans the current theme folder for a module named 'colorbox'. It returns all subfolders as styles.

So suppose my theme is called Bartik, I could create a folder:

sites/all/themes/bartik/colorbox/customstyle and this will be be selectable in the styles dropdown.

Please test and commit.

CommentFileSizeAuthor
colorbox-custom-styles.patch1.81 KBBarisW

Comments

frjo’s picture

Status: Needs review » Closed (works as designed)

Simply add your custom Colorbox CSS to your theme and set the style to "None" in the Colorbox settings.

Anonymous’s picture

Simply add your custom Colorbox CSS to your theme and set the style to "None" in the Colorbox settings.... doesn't work for me?

Seems to be unable to find the image files for the controls and borders.

EDIT: If I place the images in a sub-folder under the css file of the theme if finds them, i.e theme => css => images... I had them in the theme => images folder but the colorbox does not seem to like relative paths in the css file i.e. background:url(../images/controls.png).

Will this be fixed so I do not need two image folders in my theme?

Thanks

Anonymous’s picture

Version: 7.x-1.x-dev » 7.x-1.3
Category: feature » support
Status: Closed (works as designed) » Needs work

sorry see comment above... Thanks

lsolesen’s picture

Category: support » feature
hanpersand’s picture

It would be ideal if, as the OP asks, one could create custom styles in the theme directory and have them be select-able in the Colorbox style dropdown. But, for others who are struggling with the way this works now, the readme instructions worked perfectly for me:

Add a custom Colorbox style to your theme:
----------------------------------------
The easiest is to start with either the default style or one of the
example styles from the Colorbox plugin. Simply copy the whole
style folder to the theme and rename it and the files to
something logical.

Add entries in the themes info file for the Colorbox CSS/JS files.

In the Colorbox settings select "None" as style. This will leave the
styling of Colorbox up to your theme.

My use case:
The "Default" colorbox style was very close--I just needed to alter the jquery to get the caption/title div to stop appearing/disappearing on mouseover (I wanted it to be persistent).

What I did:
1. Created a "colorbox" sub-folder in my theme.
2. Copied the contents (including images subdirectory) of the "default" style folder from the Colorbox module into my "colorbox" subdirectory in my theme folder.
3. I renamed the .css and .js files to colorbox_mytheme_style just to be thorough.
4. I added the two new js and css file paths to the scripts and css lists in my custom theme .info file.
5. I set Colorbox to use "none" in the style config.
6. I edited the jquery and css files to customize them. I was able to comment out the function that was causing the caption issues, so that the caption stays visible. I was also able to add a background color for captions for lt-ie9, since IE7/8 don't support background opacity.

I'd link to the live example, but it's not launched yet.

Anonymous’s picture

Issue summary: View changes

I have been trying to follow the instructions for adding custom styling that are in the Colorbox documentation. Before changing ANY of the code in the files I tried to see if the colorbox was working the way it should. Instead of functioning as the default style should, the colorbox opens up behind the page content. Obviously there is an issue with how the files are being accessed. Does anyone have any suggestions? Keep in mind, I already followed the instructions in the documentation exactly, so please do not suggest that.

EDIT//
I just removed the lines in the .info file for linking the stylesheet and javascript with the same result so it seems these files aren't being called at all??

EDIT//
Resolved issue by clearing cache in config/performance

neslee canil pinto’s picture

Status: Needs work » Closed (works as designed)