WebStyle Define Colors?

Is it possible to define a set of colors to be used on a style?

I’d like to create a theme with x colors that the styles would use which would make it possible to just change the list of colors rather than each Style.

Don’t think so. But if it would help you can Subclass a Style.
Create a “main” style that looks the way you want it. Then create a new style that has your “Main” style as Super. Then only add the things that should differ from the “main” style to the new style.

Don’t know if that would make things easier for you though? :confused:

ooooh… Thanks for that idea Albin!

It’s quite useful :slight_smile:

I was hoping I could mod style colors via code. :frowning:

Understanding Properties
The properties of a Style are not traditional properties. For example, you can’t get their values or set their values via code. However, they feel very much like properties when you are editing them in the Style Editor. They are called properties for the sake of simplicity. Perhaps they can be thought of as “pseudo-properties,” but don’t expect that you can bypass the functionality of the Style Editor via code.

Maybe this could help? Looks like you can change the CSS “on-the-fly” with Web Custom Controls from @Daniel Taylor (not supported by Xojo and all that.)

Thanks again Albin. I use Web Custom Controls to use html in listbox cells and didn’t think to check to see if WCC could do that!

Via code it looks like you can assign styles on the fly. So if I define a bunch of styles, I could use WebPage.Style = myStyle to assign predefined styles…

Nice. Xojo projects that are saved as “Xojo Project” makes it easy to define Styles using a text editor! Looks like I can write out a bunch of text files for the background colors I need and then drag them into the project!

#tag WebStyle
WebStyle StyleBackgroundBlue
Inherits WebStyle
#tag WebStyleStateGroup
misc-background=solid C5C3FEFF
#tag EndWebStyleStateGroup
#tag WebStyleStateGroup
#tag EndWebStyleStateGroup
#tag WebStyleStateGroup
#tag EndWebStyleStateGroup
#tag WebStyleStateGroup
#tag EndWebStyleStateGroup
End WebStyle StyleBackgroundBlue
#tag EndWebStyle

I just generated 145 Styles with Backgrounds for each HTML Named Color! :slight_smile:

You can download it here: http://campsoftware.com/blog/xojo-background-html-named-color-styles-generated-from-filemaker

So yes, you can assign styles to controls via code.

You cannot create or modify styles in code. Those must be done in the IDE.