Add FieldColor to Plugin Settings

Hi to all members,

I would like to integrate the vue element FieldColor in the plugin settings. The idea is that users can specify a color in the settings, which can then be viewed as a color in a galley created by the plugin. The color setting of the default theme plugin can not be used, because the color selection should also be possible when using other theme plugins.

I want my plugin to provide a color selection in the plugin settings, just like the default theme plugin does but not in the website theme settings but in the plugin settings. For this I thought it would be reasonable to use the colorpicker that is already integrated in OJS, so FieldColor. Unfortunately, I cannot add FieldColor in the settings template as fbvElement because there is no corresponding definition for FieldColor in lib/pkp/templates/form. Also, I cannot use the usual functions for including vue elements (such as addOption or addField) because I use Form as class as recommended for Settings and the functions are not defined there.


class PluginSettingsForm extends Form

Is there any way I can include FieldColor in the plugin settings? Can I somehow include it in the template, or use another class so that I can include it via addField?

I am currently using version pulled from OJS main branch on github.

I am very glad about any help!

Hi @tnier01,

Unfortunately, it’s not possible to add in the FieldColor Vue component to a plugin form in the way you are describing. The plugin settings forms that inherit from Form use the older way of creating forms using the fbvElements and these do not have access to the Vue components.

It sounds like what you are trying to do may be suitable for a theme plugin rather than a generic plugin. It would not allow you to add the colour picker to the plugin settings, but you could include a colour picker with the theme settings as described in the Theme Options API Documentation.

Hope that helps.


PKP Team

1 Like

Hi @ewhanson,

thank you very much for your answer, I expected that in a certain way.

Since I am doing other customizations besides this one (e.g. additional elements in the submission process and in the database) I thought it is the right way to use a generic plugin.
I have now decided that the color is handled by text input of a HEX color code.

Best regards