Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - Русский


color

returns the color id of a color

Syntax

id=color(name)
id=color(r,g,b)

Arguments

name

name of a color.

r,g,b

RGB integer values of a color.

id

id of the color.

Description

color returns the color id corresponding to its argument:

  • name must be the name of a known color (see color_list).

  • r, g and b must be integers between 0 and 255 corresponding to colors components red, green and blue. As usual 0 means no intensity and 255 means all the intensity of the color.

If the requested color does not exist in the current colormap it is added to the colormap. If no window exists, the color is added to the default figure colormap.

This function can be used to specify the foreground or background colors when plotting.

Examples

x=linspace(-2*%pi,2*%pi,100)';
// using existing colors
e=plot2d(x,[sin(x),cos(x)],style=[color("red"),color("green")]);
// new colors: there are added to the colormap
e(1).foreground=color("purple"); e(2).foreground=color("navy blue");
// using RGB values
e(1).foreground=color(255,128,128);

See also

  • colormap — set and/or get a figure colormap.
  • color_list — list of named colors
  • getcolor — открывает диалог для показа цветов текущей цветовой карты или цветовой карты по умолчанию
Report an issue
<< addcolor color_management color_list >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:18:33 CEST 2024