-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcolor.m
78 lines (77 loc) · 4.14 KB
/
color.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% COLOR CLASS %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % %
% % Author: Frederic Depuydt %
% % Company: KU Leuven %
% % Contact: frederic.depuydt@kuleuven.be; f.depuydt@outlook.com %
% % Version: 1.0 %
% % %
% % A Color class to easily apply colors to plots %
% % %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % PROPERTIES %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % %
% % usage: result = color.property %
% % %
% % ch1 Returning the color of scope channel 1 %
% % ch2 Returning the color of scope channel 2 %
% % ch3 Returning the color of scope channel 3 %
% % ch4 Returning the color of scope channel 4 %
% % %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % FUNCTIONS (static) *Object creation* %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % %
% % usage: objColor = color.function(var1, var2, ...) %
% % %
% % PROFIBUS() Returns PROFIBUS color %
% % PROFIBUS('m') Returns PROFIBUS color for a MarkerFace %
% % %
% % PROFINET() Returns PROFINET color %
% % PROFINET('m') Returns PROFINET color for a MarkerFace %
% % %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
classdef color
properties (Constant)
ch1 = struct('color',[240,180,000]/256);
ch2 = struct('color',[030,144,255]/256);
ch3 = struct('color',[199,021,133]/256);
ch4 = struct('color',[034,139,034]/256);
lightgrey = struct('color',[180 180 180]/256);
lightpurple = struct('color',[220 120 255]/256);
end
methods (Static)
function obj = PROFIBUS(varargin)
if isempty(varargin)
obj = struct('color',[76 0 153]/256);
else
while ~isempty(varargin)
if(ischar(varargin{1}))
switch lower(varargin{1})
case 'm'
obj = struct('MarkerFaceColor',[76 0 153]/256);
end
end
varargin(1) = [];
end
end
end
function obj = PROFINET(varargin)
if isempty(varargin)
obj = struct('color',[124 213 45]/256);
else
while ~isempty(varargin)
if(ischar(varargin{1}))
switch lower(varargin{1})
case 'm'
obj = struct('MarkerFaceColor',[124 213 45]/256);
end
end
varargin(1) = [];
end
end
end
end
end