Skip to content

Instantly share code, notes, and snippets.

@mazharul-miraz
Forked from dylnmc/color_picker.sh
Created April 13, 2019 08:00
Show Gist options
  • Save mazharul-miraz/7166ed6b6d978a122541b74a532f3fbf to your computer and use it in GitHub Desktop.
Save mazharul-miraz/7166ed6b6d978a122541b74a532f3fbf to your computer and use it in GitHub Desktop.

Revisions

  1. @dylnmc dylnmc revised this gist Oct 23, 2016. 1 changed file with 42 additions and 17 deletions.
    59 changes: 42 additions & 17 deletions color_picker.sh
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,10 @@
    #!/bin/sh

    # see what it looks like here:
    # https://i.stack.imgur.com/2eP5Q.png
    # view here:
    # https://i.stack.imgur.com/OK3po.png

    e=$'\e['

    START='16'
    STEP='6'
    LEVEL='77'

    for n in {0..7}; do
    printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
    done
    @@ -19,20 +15,49 @@ for n in {8..15}; do
    done
    printf '\n\n'

    for i in {0..2}; do
    for j in {0..5}; do
    for k in {0..11}; do
    if (( $k < 6 )); then
    n="$(( $START + ( $k * $STEP ) + $j + ( $LEVEL * $i) ))"
    else
    n="$(( $START + ( ( 17 - $k ) * $STEP ) + $j + ( $LEVEL * $i) ))"
    fi
    printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
    done
    printf '\n'
    STEP='6'

    START='16'
    for i in {0..5}; do
    for j in {0..11}; do
    if (( $j < 6 )); then
    n="$(( $START + ( $j * $STEP ) + $i))"
    else
    n="$(( $START + ( ( 17 - $j ) * $STEP ) + $i))"
    fi
    printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
    done
    printf '\n'
    done
    printf '\n'

    START='93'
    for i in {0..5}; do
    for j in {0..11}; do
    if (( $j < 6 )); then
    n="$(( $START + ( $j * $STEP ) - $i))"
    else
    n="$(( $START + ( ( 17 - $j ) * $STEP ) - $i))"
    fi
    printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
    done
    printf '\n'
    done
    printf '\n'

    START='160'
    for i in {0..5}; do
    for j in {0..11}; do
    if (( $j < 6 )); then
    n="$(( $START + ( $j * $STEP ) + $i))"
    else
    n="$(( $START + ( ( 17 - $j ) * $STEP ) + $i))"
    fi
    printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
    done
    printf '\n'
    done
    printf '\n'

    for n in {232..243}; do
    printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
  2. @dylnmc dylnmc revised this gist Oct 19, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions color_picker.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    #!/bin/sh

    # see what it looks like here:
    # https://i.stack.imgur.com/2eP5Q.png

    e=$'\e['

    START='16'
  3. @dylnmc dylnmc revised this gist Oct 19, 2016. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions color_picker.sh
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,16 @@ START='16'
    STEP='6'
    LEVEL='77'

    for n in {0..7}; do
    printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
    done
    printf '\n'

    for n in {8..15}; do
    printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
    done
    printf '\n\n'

    for i in {0..2}; do
    for j in {0..5}; do
    for k in {0..11}; do
  4. @dylnmc dylnmc created this gist Oct 19, 2016.
    32 changes: 32 additions & 0 deletions color_picker.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    #!/bin/sh

    e=$'\e['

    START='16'
    STEP='6'
    LEVEL='77'

    for i in {0..2}; do
    for j in {0..5}; do
    for k in {0..11}; do
    if (( $k < 6 )); then
    n="$(( $START + ( $k * $STEP ) + $j + ( $LEVEL * $i) ))"
    else
    n="$(( $START + ( ( 17 - $k ) * $STEP ) + $j + ( $LEVEL * $i) ))"
    fi
    printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
    done
    printf '\n'
    done
    printf '\n'
    done

    for n in {232..243}; do
    printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
    done
    printf '\n'

    for n in {255..244}; do
    printf "${e}"'38;05;'"${n}"'m%-6s' '('"$n"') '
    done
    printf '\n'