Fun with Colors

With stylesheets in MPS, you have a few built-in ways to choose a color.

You can specify a named color:

StyleNamed.PNG

You can specify a color in hex:

StyleHex.PNG

Through the interface IQueryFunction_Color, you can specify a color in other interesting ways, too.

Here is a sample of a node called ColorPickerColor.  It extends IQueryFunction_Color, and its editor is defined to be a Swing component (a JColorChooser):

StyleChooser1.png

StyleChooser2.PNG

I'm not very good at Swing, so this is just the stock color picker, but I think it is really cool that MPS can do this. It shows the ability of MPS to work in domain specific languages beyond what one could easily do with the lexer/parser model.

Anyway, just thought I'd share.  Hopefully someone else finds it interesting.  :-)

Thanks for MPS!

Robert



Attachment(s):
StyleNamed.PNG
StyleHex.PNG
StyleChooser1.png
StyleChooser2.PNG
1 comment
Avatar
Permanently deleted user
Comment actions Permalink

Hello, Robert.

Thanks for sharing this here :-) BTW, we have mediawiki: http://www.jetbrains.net/mpswiki/Main_Page where you can post stuff similar to this.

Regards,

Konstantin

0

Please sign in to leave a comment.