function s = skill_color(x,f,varargin)
%SKILL_COLOR  One line description goes here.
%
%   More detailed description goes here.
%
%   Syntax:
%   varargout = skill_color(varargin)
%
%   Input: For <keyword,value> pairs call skill_color() without arguments.
%   varargin  =
%
%   Output:
%   varargout =
%
%   Example
%   skill_color
%
%   See also

%% Copyright notice
%   --------------------------------------------------------------------
%   Copyright (C) 2013 Deltares
%       Joost den Bieman
%
%       joost.denbieman@deltares.nl
%
%       P.O. Box 177
%       2600 MH Delft
%       The Netherlands
%
%   This library is free software: you can redistribute it and/or modify
%   it under the terms of the GNU General Public License as published by
%   the Free Software Foundation, either version 3 of the License, or
%   (at your option) any later version.
%
%   This library is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%   GNU General Public License for more details.
%
%   You should have received a copy of the GNU General Public License
%   along with this library.  If not, see <http://www.gnu.org/licenses/>.
%   --------------------------------------------------------------------

% This tool is part of <a href="http://www.OpenEarth.eu">OpenEarthTools</a>.
% OpenEarthTools is an online collaboration to share and manage data and
% programming tools in an open source, version controlled environment.
% Sign up to recieve regular updates of this function, and to contribute
% your own tools.

%% Version <http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html>
% Created: 18 Sep 2013
% Created with Matlab version: 8.1.0.604 (R2013a)

% $Id$
% $Date$
% $Author$
% $Revision$
% $HeadURL$
% $Keywords: $

%%
OPT = struct(...
    'data_type', 'bss', ...
    'cutoff_bss', [0.3 0.6], ...
    'cutoff_diff', [-0.05 0.05]);

OPT = setproperty(OPT, varargin{:});

switch OPT.data_type
    case 'bss'
        if isreal(x)
            if x == 0
            	s = '';
            elseif x < OPT.cutoff_bss(1) 
                s = ['\textcolor{red}{' num2str(x, f) '}'];
            elseif x >= OPT.cutoff_bss(2)
                s = ['\textcolor[rgb]{0,0.8,0.2}{' num2str(x, f) '}'];                
            else 
                s = num2str(x, f);
            end
        else
            s = num2str(x, f);
        end
    case 'diff'
        if isreal(x)
            if x == 0
            	s = '';
            elseif x < OPT.cutoff_diff(1) 
                s = ['\textcolor{red}{' num2str(x, f) '}'];
            elseif x >= OPT.cutoff_diff(2)
                s = ['\textcolor[rgb]{0,0.8,0.2}{' num2str(x, f) '}'];                
            else 
                s = num2str(x, f);
            end
        else
            s = num2str(x, f);
        end
end