Examples: NotesColorObject class

This agent builds a rich text item that contains one line for each Domino® color. The line identifies the Domino® color, the RGB values, and the HSL values. The line displays in the color being represented so some lines are not visible depending on the background color of the form. The form, named Colors, has two fields named Subject (text) and Body (rich text).

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim doc As NotesDocument
  Dim rti As NotesRichTextItem
  Dim rts As NotesRichTextStyle
  Dim color As NotesColorObject
  Set db = session.CurrentDatabase
  Set doc = New NotesDocument(db)
  Call doc.ReplaceItemValue("Form", "Colors")
  Call doc.ReplaceItemValue("Subject", "Colors")
  Set color = session.CreateColorObject
  Set rti = doc.CreateRichTextItem("Body")
  Set rts = session.CreateRichTextStyle
  rts.FontSize = 12
  rts.Bold = True
  For i = 0 To 240
    color.NotesColor = i
    rts.NotesColor = i
    Call rti.AppendStyle(rts)
    Call rti.AppendText(Format(i, "000"))
    Call rti.AddTab(1)
    Call rti.AppendText("Red " & Format(color.Red, "000"))
    Call rti.AddTab(1)
    Call rti.AppendText("Green " & Format(color.Green, "000"))
    Call rti.AddTab(1)
    Call rti.AppendText("Blue " & Format(color.Blue, "000"))
    Call rti.AddTab(1)
    Call rti.AppendText("Hue " & Format(color.Hue, "000"))
    Call rti.AddTab(1)
    Call rti.AppendText("Saturation " & Format(color.Saturation, _
    "000"))
    Call rti.AddTab(1)
    Call rti.AppendText("Luminance " & Format(color.Luminance, "000"))
    If i <> 240 Then Call rti.AddNewLine(1)
  Next
  Call doc.Save(True, True)
End Sub