Perspective: Setting up default style class and binding on new components

Is there a way to set a new default style class and bindings for perspective components being added into the view? For example, if I have a buttons that will all take on the same style class, instead of adding it to the view and manually selecting the style, it would already have it applied. Additionally if all my buttons would have the same bindings, is it possible to set that as a default as well?

I might be misunderstanding the use-case, but this sounds like something that would best be handled with theming. Have you investigated the use of themes in your project?

If you’re referring to bindings outside of style/appearance, then no - there is no way to always have those bindings in position when you place a button with one exception: if you were to place the bindings on a button where that button is the only component in a View, then you could re-use that View via an Embedded View component. This would result in a pattern where you would be re-using the same button with the same settings throughout the project. You would still have to place an Embedded View and then configure the path to be that of the View which contains the button.

I did take a look into themes, the documentation page on themes shows the addition of a few themes (mainly dark and light), the problem with the themes is that it clashes harshly with the current views. Any components with a background colour set will not change while the text would still invert. This would cause issues switching from light to dark bringing white text on white background for example. Additionally I would like to implement my own colour scheme to the project.

Thank you for the help on the bindings I can definitely look into that.

This is because you need to use the css variables for all of your colours. The reason the text inverts is because, if they're not overridden in the designer, colours will come from whatever colour the theme defines for that component, or an inherited colour if nothing is defined for it specifically. If you set your background colour to a css variable, then it too will change with the theme to suit the theme colours. This is the beauty of css and theming

Thank you very much, I see what you are talking about and it does change with theme selection, follow up question for me would be, can I change ignitions default themes by editing any files or make my own theme file? If I were to make it how would I import it into ignition.

This post can give some quick hints. If you look in the themes directory of the Perspective module in the Gateway file system you should also find a read.me file which supposedly contains directions for how to complete the setup.