Re: Quick newbie help on coloring one letter at a time without space?
Le 15/06/2021 à 16:52, darki...@jesusgod-pope666.info a écrit : I don't know why it would not have written to the forum, I thought I did that - and not you. %Rainbow Script: #(define (color-list? x) (and (list? x) (every color? x))) #(define-markup-command (rainbow layout props colors text) (color-list? string?) (let* ((chars (string->list text)) (atomic-strings (map string chars))) (interpret-markup layout props (make-concat-markup (map make-with-color-markup (apply circular-list colors) atomic-strings) %Rainbow end This is what I am using at the moment. --- \fontsize #-1 \rainbow #'("red" "orange" "yellow" "green" "lightblue" "blue" "violet") "Flojte sangbog til Bornene // Whistle song book to the Children" } But I would like to be able to have it work with special chars and more defined colors like #(rgb-color 1 0 0) sorta thing :) Dearly regards - Darkijah Here is how far I could get it: \version "2.22.1" #(use-modules (srfi srfi-26)) #(define (color-list? x) (and (list? x) (every color? x))) #(define (unicode-aware-string->atomic-strings str) (let* ((chars (string->list str))) (map (cute apply string <>) (let loop ((remaining-chars chars) (new-chars '())) (cond ((null? remaining-chars) (reverse! new-chars)) ((eqv? #\303 (car remaining-chars)) (loop (cddr remaining-chars) (cons (list (car remaining-chars) (cadr remaining-chars)) new-chars))) (else (loop (cdr remaining-chars) (cons (list (car remaining-chars)) new-chars #(define-markup-command (rainbow layout props colors text) (color-list? string?) (interpret-markup layout props (make-concat-markup (map make-with-color-markup (apply circular-list colors) (unicode-aware-string->atomic-strings text) \markup \fontsize #-1 \rainbow #`(,(rgb-color 0.5 0.4 0.2) "orange" "yellow" "green" "lightblue" "blue" "violet") "ABC ÅØ" This should have more reliable Unicode support. Note the Scheme syntax to put RGB colors in the list. You have to replace the ' (quote) with ` (backtick, introducing what is called a quasiquote). Then you can prefix an expression in the middle with a , (comma). Best, Jean
Re: Quick newbie help on coloring one letter at a time without space?
Le 15/06/2021 à 14:05, darki...@jesusgod-pope666.info a écrit : Okay, I had this wonderful script that makes colors in all the rainbow colors. But I could not figure out to set it up with (rgb-color 0.953 0.471 0.125) and not sure it is possible. Second the problem with special characters which are norm in my native tongue. like æ ø å won't work with colors. So, I'm thinking can I do it manual, one letter at a time? Like I only need to do it once I guess, for some of things at least. I have only been able to color whole words. I would need to do what the script does but just manual, like -- in rainbow colors. I will make a link to it then called line = and be able to insert it the places needed. The script is very nice, and the idea is amazing, but I just really wanna have it working, both those colors I have sorted out for the best results and Danish letters as well. Can anyone help me with that? Thanks, I know it is most likely very newbish, but I am still a newb and still confused about a lot of things. I'm not coder and never was. Thanks for your help, all of you :) Dearly regards Darkijah. Hello, Sorry for not expanding this script further, I was (and am) busy with other things. Could you paste the version you are using now? This would make it easier to help you. Also, could you clarify what you meant with this paragraph? Like I only need to do it once I guess, for some of things at least. I have only been able to color whole words. I would need to do what the script does but just manual, like -- in rainbow colors. I will make a link to it then called line = and be able to insert it the places needed. Best, Jean
Quick newbie help on coloring one letter at a time without space?
Okay, I had this wonderful script that makes colors in all the rainbow colors. But I could not figure out to set it up with (rgb-color 0.953 0.471 0.125) and not sure it is possible. Second the problem with special characters which are norm in my native tongue. like æ ø å won't work with colors. So, I'm thinking can I do it manual, one letter at a time? Like I only need to do it once I guess, for some of things at least. I have only been able to color whole words. I would need to do what the script does but just manual, like -- in rainbow colors. I will make a link to it then called line = and be able to insert it the places needed. The script is very nice, and the idea is amazing, but I just really wanna have it working, both those colors I have sorted out for the best results and Danish letters as well. Can anyone help me with that? Thanks, I know it is most likely very newbish, but I am still a newb and still confused about a lot of things. I'm not coder and never was. Thanks for your help, all of you :) Dearly regards Darkijah.