Is your feature request related to a problem? Please describe.
It would be nice for outside developers to have more control over the on-block display of different fields, especially if they are trying to customize the look-and-feel of Blockly for different audiences.
Describe the solution you'd like
The ability to pass a class string to the JS Constructor's optconfig property or the JSON Definition of a field would be one way to accomplish this. The string would then be appended to the field's fieldGroup during initialization.
Describe alternatives you've considered
Giving each field type its own css class that could be appended to the fieldGroup_ would also go a long way towards customizability.
Adding field customization to the themes API is also an option, but it seems like that would complicate the simplicity of themes.
Open Problems
CSS API
Currently I don't believe the CSS or DOM structure are considered to be part of Blockly's public API. Adding the ability to apply classes to fields would, in a way, make them part of the public API because fields' structures and css would have to become stable, so as not to break people.
The CSS should probably be reorganized before trying to complete this issue.
Relation to Themes
Themes make the colours of blockly dynamic, which is rad, but there's no way to access those colours from CSS (as far as I know). This could complicate things.
Field Sizing
Currently field sizing is handled programatically. This makes it less flexible when trying to impliment CSS. For example if an outside developer added a class to a colour field that made it taller or wider than default, it would not be handled correctly by the renderer.
Editors
It may also be useful for outside developers to style the editor of a field (angle fields come to mind as a good example).
Is your feature request related to a problem? Please describe.
It would be nice for outside developers to have more control over the on-block display of different fields, especially if they are trying to customize the look-and-feel of Blockly for different audiences.
Describe the solution you'd like
The ability to pass a class string to the JS Constructor's optconfig property or the JSON Definition of a field would be one way to accomplish this. The string would then be appended to the field's fieldGroup during initialization.
Describe alternatives you've considered
Open Problems
CSS API Currently I don't believe the CSS or DOM structure are considered to be part of Blockly's public API. Adding the ability to apply classes to fields would, in a way, make them part of the public API because fields' structures and css would have to become stable, so as not to break people.
The CSS should probably be reorganized before trying to complete this issue.
Relation to Themes Themes make the colours of blockly dynamic, which is rad, but there's no way to access those colours from CSS (as far as I know). This could complicate things.
Field Sizing Currently field sizing is handled programatically. This makes it less flexible when trying to impliment CSS. For example if an outside developer added a class to a colour field that made it taller or wider than default, it would not be handled correctly by the renderer.
Editors It may also be useful for outside developers to style the editor of a field (angle fields come to mind as a good example).