xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

NtoColor()

Converts a numeric color attribute to a color string.

Syntax

NtoColor( <nColor> , [<lAsChar>]) --> cColor

Arguments

<nColor>
This is a numeric color attribute in the range between 0 and 255.
<lAsChars>
If set to .T. (true), the function returns a SetColor() compliant character string. The default is .F. (false), i.e. the returned string encodes colors as digits.

Return

The function returns a color string encoding forground and background color as characters or digits.

Info

See also:ColorToN()
Category: CT:Video , Screen functions
Source:ct\color.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example displays all 256 colors.

   PROCEDURE Main
      LOCAL nRow, nCol, nColor, cColor

      nRow := 0
      nCol := 0

      FOR nColor := 0 TO 255
         cColor := NtoColor( nColor, .T. )

         @ nRow, nCol SAY PadC( cColor, 8 ) COLOR (cColor)

         IF ++nRow > MaxRow()
            nRow := 0
            nCol += 8
         ENDIF
      NEXT
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe