Merci Yves Dutrieux.
Pour l'utilisation d'un tableau, je n'ai pas compris.
Macro sur le fichier joint : Couleur de lettre.odt
<https://www.cjoint.com/c/HFhp365pd8n>
donne :
REM ***** BASIC *****
sub DiffCouleur12c
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent
curseur=ThisComponent.currentcontroller.ViewCursor
' change les 10 caractères qui suivent le curseur courant par une couleur
pré-définie
rem couleur premier caractère
curseur.goright(1,true)
curseur.CharColor=rgb(107,52,02)
curseur.goleft(1,false)
curseur.goright(1,false)
curseur.goright(1,true)
curseur.CharColor=rgb(14,72,98)
curseur.goleft(1,false)
curseur.goright(1,false)
curseur.goright(1,true)
curseur.CharColor=rgb(643,20,02)
curseur.goleft(1,false)
curseur.goright(1,false)
curseur.goright(1,true)
curseur.CharColor=rgb(544,00,96)
curseur.goleft(1,false)
curseur.goright(1,false)
curseur.goright(1,true)
curseur.CharColor=rgb(887,42,40)
curseur.goleft(1,false)
curseur.goright(1,false)
curseur.goright(1,true)
curseur.CharColor=rgb(41,21,12)
curseur.goleft(1,false)
curseur.goright(1,false)
curseur.goright(1,true)
curseur.CharColor=rgb(165,386,24)
curseur.goleft(1,false)
curseur.goright(1,false)
curseur.goright(1,true)
curseur.CharColor=rgb(544,00,96)
curseur.goleft(1,false)
curseur.goright(1,false)
curseur.goright(1,true)
curseur.CharColor=rgb(148,869,11)
curseur.goleft(1,false)
curseur.goright(1,false)
curseur.goright(1,true)
curseur.CharColor=rgb(161,45,95)
curseur.goleft(1,false)
curseur.goright(1,false)
curseur.goright(1,true)
curseur.CharColor=rgb(22,36,51)
curseur.goleft(1,false)
curseur.goright(1,false)
rem couleur 12e et dernier caractère
curseur.goright(1,true)
curseur.CharColor=rgb(106,982,43)
curseur.goleft(1,false)
curseur.goright(1,false)
end sub
C'est pas évident de récupérer les codes de couleur utilisés par LibreOffice
pour les convertir en RVB