Commit 0d9fc516 authored by Fabio Pitino's avatar Fabio Pitino

Fix change to default colors in job log

parent f5a785a1
---
title: Fix change to default foreground and backgorund colors in job log
merge_request: 20787
author:
type: fixed
...@@ -94,7 +94,7 @@ module Gitlab ...@@ -94,7 +94,7 @@ module Gitlab
def on_38(stack) { fg: fg_color_256(stack) } end def on_38(stack) { fg: fg_color_256(stack) } end
def on_39(_) { fg: fg_color(9) } end def on_39(_) { fg: nil } end
def on_40(_) { bg: bg_color(0) } end def on_40(_) { bg: bg_color(0) } end
...@@ -114,8 +114,7 @@ module Gitlab ...@@ -114,8 +114,7 @@ module Gitlab
def on_48(stack) { bg: bg_color_256(stack) } end def on_48(stack) { bg: bg_color_256(stack) } end
# TODO: all the x9 never get called? def on_49(_) { bg: nil } end
def on_49(_) { fg: fg_color(9) } end
def on_90(_) { fg: fg_color(0, 'l') } end def on_90(_) { fg: fg_color(0, 'l') } end
......
...@@ -61,9 +61,9 @@ module Gitlab ...@@ -61,9 +61,9 @@ module Gitlab
case case
when changes[:reset] when changes[:reset]
reset! reset!
when changes[:fg] when changes.key?(:fg)
@fg = changes[:fg] @fg = changes[:fg]
when changes[:bg] when changes.key?(:bg)
@bg = changes[:bg] @bg = changes[:bg]
when changes[:enable] when changes[:enable]
@mask |= changes[:enable] @mask |= changes[:enable]
......
...@@ -147,6 +147,10 @@ describe Gitlab::Ci::Ansi2json::Style do ...@@ -147,6 +147,10 @@ describe Gitlab::Ci::Ansi2json::Style do
[%w[1], %w[0], '', 'resets style from format bold'], [%w[1], %w[0], '', 'resets style from format bold'],
[%w[1 3], %w[0], '', 'resets style from format bold and italic'], [%w[1 3], %w[0], '', 'resets style from format bold and italic'],
[%w[1 3 term-fg-l-red term-bg-yellow], %w[0], '', 'resets all formats and colors'], [%w[1 3 term-fg-l-red term-bg-yellow], %w[0], '', 'resets all formats and colors'],
# default foreground
[%w[31 42], %w[39], 'term-bg-green', 'set foreground from red to default leaving background unchanged'],
# default background
[%w[31 42], %w[49], 'term-fg-red', 'set background from green to default leaving foreground unchanged'],
# misc # misc
[[], %w[1 30 42 3], 'term-fg-l-black term-bg-green term-bold term-italic', 'adds fg color, bg color and formats from no style'], [[], %w[1 30 42 3], 'term-fg-l-black term-bg-green term-bold term-italic', 'adds fg color, bg color and formats from no style'],
[%w[3 31], %w[23 1 43], 'term-fg-l-red term-bg-yellow term-bold', 'replaces format italic with bold and adds a yellow background'] [%w[3 31], %w[23 1 43], 'term-fg-l-red term-bg-yellow term-bold', 'replaces format italic with bold and adds a yellow background']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment