[UP]


Manual Reference Pages  - color_name2rgb (3)

NAME

COLOR_NAME2RGB(3f) - [M_pixel:COLOR] returns the RGB values in the range 0 to 100 for a given known color name. (LICENSE:PD)

CONTENTS

Synopsis
Description
Example
Author
License

SYNOPSIS

subroutine color_name2rgb(name,r,g,b,echoname)

    character(len=20),intent(in)   :: name
    real,intent(out)               :: r,g,b
    character(len=20),intent(out)  :: echoname

DESCRIPTION

COLOR_NAME2RGB() returns the RGB values in the range 0 to 100 for a given known color name. Most X11 Windows color names are supported. If the name is not found, ECHONAME is set to "Unknown".

EXAMPLE

A sample program:

    program demo_color_name2rgb
    use M_pixel, only : hue, color_name2rgb
    implicit none
    !
    ! list colors known to colorname2rgb(3f) & corresponding RGB values
    !
    character(len=20) :: name
    character(len=20) :: echoname
    real              :: red,green,blue
    integer           :: i
    TRYALL: do i=1,10000
       ! weird little thing where the color names have aliases
       ! that are numeric strings
       write(name,’(i0)’)i
       ! get the RGB values and English name of the color
       call color_name2rgb(name,red,green,blue,echoname)
       ! the last color name is "Unknown" so the loop should exit
       if(echoname.eq.’Unknown’)exit TRYALL
       ! display the English name and RGB values for the name
       write(*,*)echoname,int([red,green,blue])
    enddo TRYALL
    !write(*,*)’Number of colors found is ’,i-1
    end program demo_color_name2rgb

AUTHOR

John S. Urban

LICENSE

Public Domain


color_name2rgb (3) March 11, 2021
Generated by manServer 1.08 from 0a60671b-1b1a-4fff-9e26-84e6d5ca42bb using man macros.