image thumbnail
from Matlab CSS (MSS) by Joris Gillis
Matlab CSS tries to bring the power of W3C's Cascading Stylesheets to Matlab GUIs.

Matlab CSS (MSS)

Matlab CSS

Description and goal of the project

Matlab CSS (MSS) tries to bring the power of W3C's Cascading Stylesheets to Matlab GUIs.

With MSS, you have easy control over the appearance of all your GUI's through a simple CSS file.

Download

You can access the project's files in to ways: zip archive or svn.

What can be styled with MSS?

The primary target for MSS are GUIs designed with GUIDE. But in fact, you could use it for plain figures or even any type of handle-enabled object.

What styles can be applied?

Any field of a handle-object can be set with MSS. Everywhere you would normally use set(handle,'myproperty',myvalue), you could use the MSS equivalent handle {myproperty: myvalue}.

Syntax table

* {FontSize: 20}
I like big fonts all over the place
#next {background: url('forward.png')}
Give any object with a tag 'next' a nice background image
uipanel uicontrol {ForegroundColor: 1 0 0}
Make all controls inside panels have red foreground color .
uicontrol.text {FontWeight: bold}
All text labels in bold face, please
#mylist {String: "{'foo','bar','baz'}"}
Fill mylist with some values (note that this is not actually 'styling')
.checkbox , uipanel {FontAngle: italic}
Checkboxes and uipanel titles should have italic captions

Sample

A sample GUI named 'sample.fig' is shown on the left. On the right, the GUI is styled with stylefig('sample.fig','default.css'). The file 'default.css' contains all rules from the syntax table above.

A sample matlab GUI before being styled by MSS. A sample matlab GUI after being styled by MSS. The rules are those found in the syntax table

Getting started

Dowload the project files and put them somewhere were matlab can find them: add the path with addpath('fill in the dir') and optionally save the path with savepath. Run classpath. To test things out, navigate to the 'sample' subdirectory and try styling the sample GUI with stylefig('sample.fig','default.css') or by running the m-file run.

Contact us at files@mathworks.com