Return the array-index corresponding to the queried color.
Because Foreground and backround colors lists share the same name, no matter what array is used to find the color index. Thus, the foreground array is used.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | color |
Color definition. |
Index into the colors arrays.
elemental function color_index(color)
!< Return the array-index corresponding to the queried color.
!<
!< @note Because Foreground and backround colors lists share the same name, no matter what array is used to find the color index.
!< Thus, the foreground array is used.
character(len=*), intent(in) :: color !< Color definition.
integer(int32) :: color_index !< Index into the colors arrays.
integer(int32) :: c !< Counter.
color_index = 0
do c=1, size(COLORS_FG, dim=2)
if (trim(COLORS_FG(1, c))==trim(adjustl(color))) then
color_index = c
exit
endif
enddo
endfunction color_index