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.
Comments
Comment #1
frjo commentedSimply add your custom Colorbox CSS to your theme and set the style to "None" in the Colorbox settings.
Comment #2
Anonymous (not verified) commentedSimply 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
Comment #3
Anonymous (not verified) commentedsorry see comment above... Thanks
Comment #4
lsolesen commentedComment #5
hanpersand commentedIt 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:
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.
Comment #6
Anonymous (not verified) commentedI 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
Comment #7
neslee canil pinto