File: gradient.sh

package info (click to toggle)
rust-pastel 0.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 560 kB
  • sloc: sh: 16; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 470 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

function gradient() {
    local color_from="$1"
    local color_to="$2"
    local text="$3"
    local length=${#text}

    local colors
    colors=$(pastel gradient -n "$length" "$color_from" "$color_to" -sLCh)

    local i=0
    for color in $colors; do
        pastel paint -n "$color" "${text:$i:1}"
        i=$((i+1))
    done
    printf "\n"
}


gradient yellow crimson 'look at these colors!'
gradient lightseagreen lightgreen 'look at these colors!'