From de4d273c225d1fc672c26bbe0bb3b0fe330c4528 Mon Sep 17 00:00:00 2001 From: Andinus Date: Tue, 16 Nov 2021 22:48:50 +0530 Subject: Update to latest fornax format --- lib/Fornax/CLI.rakumod | 54 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/lib/Fornax/CLI.rakumod b/lib/Fornax/CLI.rakumod index 38ed03d..35109b7 100644 --- a/lib/Fornax/CLI.rakumod +++ b/lib/Fornax/CLI.rakumod @@ -37,23 +37,28 @@ multi sub MAIN( constant $PATH = '.'; constant $BLOK = '#'; constant $DEST = '$'; + constant $STRT = '^'; constant $VIS = '-'; constant $CUR = '@'; + constant $CURPATH = '~'; constant %CANVAS = :1920width, :1080height; # Colors. constant %C = ( - red => "#f2b0a2", - blue => "#b5d0ff", - cyan => "#c0efff", - black => "#000000", - white => "#ffffff", - green => "#aecf90", - - pointer => "#093060", - pointer-red => "#5d3026", - pointer-green => "#184034", + bg-main => "#ffffff", + + red-subtle-bg => "#f2b0a2", + blue-subtle-bg => "#b5d0ff", + cyan-subtle-bg => "#c0efff", + green-subtle-bg => "#aecf90", + + fg-main => "#000000", + + fg-special-cold => "#093060", + fg-special-warm => "#5d3026", + fg-special-mild => "#184034", + fg-special-calm => "#61284f", ).map: {.key => hex2rgb(.value)}; # Every cell must be square. Get the maximum width, height and use @@ -106,7 +111,7 @@ multi sub MAIN( ) { given Cairo::Context.new($_) { # Paint the entire canvas white. - .rgb: |%C; + .rgb: |%C; .rectangle(0, 0, %CANVAS, %CANVAS); .fill; @@ -119,23 +124,30 @@ multi sub MAIN( .rectangle: |@target; given @grid[$r][$c] -> $cell { + # According to the format, current + # position may be prioritized over + # Destination symbol so we colorize it + # according to $status. when $cell eq $CUR { - .rgba: |%C, 0.56; - .rgba: |%C, 0.72 if $status == Completed; - .rgba: |%C, 0.72 if $status == Blocked; + .rgba: |%C, 0.56; + .rgba: |%C, 0.72 if $status == Completed; + .rgba: |%C, 0.72 if $status == Blocked; + } + when $cell eq $CURPATH { + .rgba: |%C, 0.84; + .rgba: |%C, 0.96 if $status == Completed; + .rgba: |%C, 0.96 if $status == Blocked; } when $cell eq $VIS { - .rgba: |%C, 0.72; - .rgba: |%C, 0.96 if $status == Completed; - .rgba: |%C, 0.96 if $status == Blocked; + .rgba: |%C, 0.72; } - when $cell eq $BLOK { .rgba: |%C, 0.56 } - when $cell eq $DEST { .rgb: |%C } - default { .rgba: |%C, 0.08 } + when $cell eq $BLOK { .rgba: |%C, 0.56 } + when $cell eq $STRT|$DEST { .rgba: |%C, 0.72 } + default { .rgba: |%C, 0.08 } } .fill :preserve; - .rgb: |%C; + .rgb: |%C; .stroke; } } -- cgit 1.4.1-2-gfad0