Browse Source

256-colors

main
pvincent 6 months ago
parent
commit
052c131e10
  1. 8
      .vscode/settings.json
  2. 28
      app/controllers/scores_controller.rb
  3. 4
      lib/formatters/ansi_formatter.rb

8
.vscode/settings.json

@ -23,11 +23,13 @@
"vscode-erb-beautify.keepBlankLines": 1, "vscode-erb-beautify.keepBlankLines": 1,
"inlineFold.regex": "(class=|className=|class:\\s*)(({(`|))|(['\"`]))(.*?)(\\2|(\\4)})", // inline AlpineJs `class: ` "inlineFold.regex": "(class=|className=|class:\\s*)(({(`|))|(['\"`]))(.*?)(\\2|(\\4)})", // inline AlpineJs `class: `
// REQUIRED FOR PLAIN 256-color ANSI SUPPORT
"terminal.integrated.drawBoldTextInBrightColors": true,
// -----------------256-color ANSI SUPPORT ----------------
"terminal.integrated.minimumContrastRatio": 1, "terminal.integrated.minimumContrastRatio": 1,
// "terminal.integrated.drawBoldTextInBrightColors": true,
"workbench.colorCustomizations" : { "workbench.colorCustomizations" : {
"terminal.foreground" : "#EEEEEE",
"terminal.background" : "#000000" "terminal.background" : "#000000"
// "terminal.foreground" : "#EEEEEE",
}, },
// ---------------------------------------------------------
} }

28
app/controllers/scores_controller.rb

@ -21,8 +21,10 @@ class ScoresController < ApplicationController
logger.info(BG_BLACK + shades) logger.info(BG_BLACK + shades)
logger.info(BG_GRAY + shades) logger.info(BG_GRAY + shades)
logger.info(BG_WHITE + shades) logger.info(BG_WHITE + shades)
logger.info(BG_BLACK + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?")
logger.info(BG_GRAY + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?")
logger.info(BG_BLACK + TEXT_GRAY_200 + "this is #{BOLD}a message in bold#{CLEAR}#{TEXT_GRAY_200}, isnt'it?")
logger.info(BG_BLACK + TEXT_GRAY_200 + "this is #{TEXT_WHITE}a message in bold#{CLEAR}#{TEXT_GRAY_200}, isnt'it?")
logger.info(BG_BLACK + TEXT_GRAY_200 + "this is #{BOLD}#{TEXT_WHITE}a message in bold#{CLEAR}#{TEXT_GRAY_200}, isnt'it?")
logger.info(BG_GRAY + TEXT_GRAY_200 + "this is #{BOLD}a message in bold#{CLEAR}#{TEXT_GRAY_200}, isnt'it?")
logger.info(BG_WHITE + TEXT_GRAY_800 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?") logger.info(BG_WHITE + TEXT_GRAY_800 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?")
logger.info(BG_WHITE + TEXT_GRAY_600 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?") logger.info(BG_WHITE + TEXT_GRAY_600 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?")
logger.info(BG_WHITE + TEXT_GRAY_400 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?") logger.info(BG_WHITE + TEXT_GRAY_400 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?")
@ -30,27 +32,13 @@ class ScoresController < ApplicationController
logger.info(BG_WHITE + TEXT_GRAY_200 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?") logger.info(BG_WHITE + TEXT_GRAY_200 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?")
logger.info(BG_WHITE + TEXT_GRAY_100 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?") logger.info(BG_WHITE + TEXT_GRAY_100 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?")
# logger.info "these are gray shades : #{TEXT_GRAY_800}800#{TEXT_GRAY_600}600#{TEXT_GRAY_400}400#{TEXT_GRAY_200}200#{TEXT_GRAY_100}100 \x1b[38;5;7m7.0\x1b[38;5;15m15.0\x1b[38;5;232m232 \x1b[38;5;233m233 \x1b[38;5;234m234 \x1b[38;5;235m235 \x1b[38;5;236m236 \x1b[38;5;237m237 \x1b[38;5;238m \x1b[38;5;239m \x1b[38;5;240m \x1b[38;5;241m \x1b[38;5;242m \x1b[38;5;243m
# \x1b[38;5;244m \x1b[38;5;245m245 \x1b[38;5;246m \x1b[38;5;247m \x1b[38;5;248m248 \x1b[38;5;249m \x1b[38;5;250m \x1b[38;5;251m \x1b[38;5;252m \x1b[38;5;253m253 \x1b[38;5;254m \x1b[38;5;255m255"
# logger.info "these are gray shades : #{BG_BLACK}#{TEXT_GRAY_800}800#{TEXT_GRAY_600}600#{TEXT_GRAY_400}400#{TEXT_GRAY_200}200#{TEXT_GRAY_100}100 \x1b[38;5;7m7.0 \x1b[38;5;15m15.0 \x1b[38;5;232m232 \x1b[38;5;233m233 \x1b[38;5;234m234 \x1b[38;5;235m235 \x1b[38;5;236m236 \x1b[38;5;237m237 \x1b[38;5;238m \x1b[38;5;239m239 \x1b[38;5;240m \x1b[38;5;241m \x1b[38;5;242m242 \x1b[38;5;243m
# \x1b[38;5;244m \x1b[38;5;245m245 \x1b[38;5;246m246 \x1b[38;5;247m \x1b[38;5;248m248 \x1b[38;5;249m249 \x1b[38;5;250m \x1b[38;5;251m \x1b[38;5;252m252 \x1b[38;5;253m253 \x1b[38;5;254m \x1b[38;5;255m255 "
# logger.info "these are gray shades : #{BG_WHITE}#{TEXT_GRAY_800}800#{TEXT_GRAY_600}600#{TEXT_GRAY_400}400#{TEXT_GRAY_200}200#{TEXT_GRAY_100}100 \x1b[38;5;7m7.0\x1b[38;5;15m15.0\x1b[38;5;232m232 \x1b[38;5;233m233 \x1b[38;5;234m234 \x1b[38;5;235m235 \x1b[38;5;236m236 \x1b[38;5;237m237 \x1b[38;5;238m \x1b[38;5;239m \x1b[38;5;240m \x1b[38;5;241m \x1b[38;5;242m \x1b[38;5;243m
# \x1b[38;5;244m \x1b[38;5;245m245 \x1b[38;5;246m \x1b[38;5;247m \x1b[38;5;248m248 \x1b[38;5;249m \x1b[38;5;250m \x1b[38;5;251m \x1b[38;5;252m \x1b[38;5;253m253 \x1b[38;5;254m \x1b[38;5;255m255"
# logger.info "these are gray shades : #{BG_BLACK}#{TEXT_GRAY_800}800#{TEXT_GRAY_600}600#{TEXT_GRAY_400}400#{TEXT_GRAY_200}200#{TEXT_GRAY_100}100"
# logger.info "these are gray shades : #{BG_WHITE}#{TEXT_GRAY_800}800#{TEXT_GRAY_600}600#{TEXT_GRAY_400}400#{TEXT_GRAY_200}200#{TEXT_GRAY_100}100"
# logger.info "these are gray shades : #{BOLD}#{TEXT_GRAY_800}800#{TEXT_GRAY_600}600#{TEXT_GRAY_400}400#{TEXT_GRAY_200}200#{TEXT_GRAY_100}100"
# logger.info "these are gray shades : #{BOLD}#{UNDERLINE}#{TEXT_GRAY_800}800#{TEXT_GRAY_600}600#{TEXT_GRAY_400}400#{TEXT_GRAY_200}200#{TEXT_GRAY_100}100"
# logger.info "these are gray shades : #{UNDERLINE}#{TEXT_GRAY_800}800#{TEXT_GRAY_600}600#{TEXT_GRAY_400}400#{TEXT_GRAY_200}200#{TEXT_GRAY_100}100"
# logger.info({ one: 1, two: 2 }) # logger.info({ one: 1, two: 2 })
# logger.info 'this is an information', { four: 4, five: 5 } # logger.info 'this is an information', { four: 4, five: 5 }
# logger.debug BigDecimal('0.0003')
logger.debug BigDecimal('0.0003')
# logger.warn 'scores are', @scores # logger.warn 'scores are', @scores
# logger.warn "this is a warning\n yop\n cool"
# logger.error 'this is an error message'
logger.warn "this is a #{BOLD}warning#{CLEAR}#{BG_YELLOW}#{TEXT_BLACK}\n yop\n cool"
logger.warn "this is a warning\n yop\n cool"
logger.error 'this is an error message'
# logger.error "error message line #1\nerror message line #2\nerror message line #3\n\n" # logger.error "error message line #1\nerror message line #2\nerror message line #3\n\n"
# logger.info 'end of normal message' # logger.info 'end of normal message'
# logger.debug @scores # logger.debug @scores

4
lib/formatters/ansi_formatter.rb

@ -8,8 +8,8 @@ require 'json'
class AnsiFormatter < SemanticLogger::Formatters::Color class AnsiFormatter < SemanticLogger::Formatters::Color
include AnsiColors include AnsiColors
ANSI_DEBUG = CLEAR + TEXT_CYAN
ANSI_INFO = CLEAR + TEXT_WHITE
ANSI_DEBUG = BG_BLACK + TEXT_GRAY_500
ANSI_INFO = BG_BLACK + TEXT_GRAY_200
ANSI_WARN = BG_YELLOW + TEXT_BLACK ANSI_WARN = BG_YELLOW + TEXT_BLACK
ANSI_ERROR = BG_RED + TEXT_BLACK ANSI_ERROR = BG_RED + TEXT_BLACK
ANSI_FATAL = DARK_BG_RED + TEXT_BLACK ANSI_FATAL = DARK_BG_RED + TEXT_BLACK

Loading…
Cancel
Save