annotate graphics/colour/setuicolours.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 82075c94eed1
children
rev   line source
samer@47 1 function setcolours(bg,fg,root)
samer@47 2 % setuicolours - set default foreground and background colours for UI elements
samer@47 3 %
samer@47 4 % setuicolours :: colour ~'background', colour ~'foreground' -> action.
samer@47 5 % setuicolours :: colour ~'background', colour ~'foreground', handle ~'root' -> action.
samer@47 6 %
samer@47 7 % colour ::= [[1,3]] | {'k','r','g','b','c','m','y','w'}.
samer@47 8 %
samer@47 9 % The 3-argument form takes the handle of the object to which properties will be attached.
samer@47 10
samer@47 11 if nargin<3, root=0; end
samer@47 12
samer@47 13 classes1={'Control','Panel'};
samer@47 14 classes2={'Container','FlowContainer','GridContainer'};
samer@47 15
samer@47 16 set(root,'DefaultFigureColor',bg);
samer@47 17 foreach(@(c)set(root,dc(c,'Foreground'),fg,dc(c,'Background'),bg),classes1);
samer@47 18 foreach(@(c)set(root,dc(c,'Background'),bg),classes2);
samer@47 19 set(root,dc('Menu','Foreground'),fg);
samer@47 20 set(root,dc('Panel','Shadow'),0.7*bg,dc('Panel','Highlight'),min(1.3*bg,1));
samer@47 21
samer@47 22 function p=dc(c,fb), p=['DefaultUI' c fb 'Color'];