From 3b037310c51ad1cc452693a5d035d2d330f32f08 Mon Sep 17 00:00:00 2001 From: Dave Snider Date: Wed, 13 Mar 2019 22:32:29 -0700 Subject: [PATCH 1/3] ml fixes for dark mode --- packages/kbn-ui-framework/dist/kui_dark.css | 38 +++--- packages/kbn-ui-framework/dist/kui_light.css | 18 +-- .../src/components/button/_button.scss | 12 +- x-pack/plugins/ml/public/_variables.scss | 10 +- .../field_data_card/_field_data_card.scss | 28 ++--- .../field_title_bar/_field_title_bar.scss | 2 +- .../job_select_list/_job_select_list.scss | 116 +++++++----------- .../job_select_list/job_select_list.html | 2 +- x-pack/plugins/ml/public/index.scss | 3 + .../components/job_details/_job_details.scss | 4 +- .../group_list/_group_list.scss | 2 +- .../event_rate_chart_directive.js | 9 +- .../fields_selection/_fields_selection.scss | 3 +- .../_index_selection_population.scss | 3 +- .../create_job/create_job_chart_directive.js | 7 +- .../create_job/create_job_chart_directive.js | 7 +- .../_timeseriesexplorer.scss | 48 ++++---- .../timeseries_chart/timeseries_chart.js | 14 +-- x-pack/plugins/ml/public/util/theme_colors.js | 26 ++++ 19 files changed, 167 insertions(+), 185 deletions(-) create mode 100644 x-pack/plugins/ml/public/util/theme_colors.js diff --git a/packages/kbn-ui-framework/dist/kui_dark.css b/packages/kbn-ui-framework/dist/kui_dark.css index 0565eeebba03c..3c06ce5b19e81 100644 --- a/packages/kbn-ui-framework/dist/kui_dark.css +++ b/packages/kbn-ui-framework/dist/kui_dark.css @@ -56,10 +56,6 @@ * 4. Fix an IE bug which causes the last child to overflow the container. * 5. Fixing this bug means we now need to align the children to the right. */ -:focus:not([class^="eui"]) { - -webkit-animation: 350ms cubic-bezier(0.694, 0.0482, 0.335, 1) 1 normal forwards focusRingAnimate; - animation: 350ms cubic-bezier(0.694, 0.0482, 0.335, 1) 1 normal forwards focusRingAnimate; } - /** * 1. Required for IE11. */ @@ -226,7 +222,7 @@ main { * 1. Override Bootstrap. */ .kuiButton--primary { - color: #FFF; + color: #000; background-color: #1BA9F5; } .kuiButton--primary:not(a):enabled:focus { color: #FFF; } @@ -234,29 +230,25 @@ main { /* 1 */ color: #FFF; } .kuiButton--primary:enabled:hover { - color: #FFF !important; - /* 1 */ + color: #000 !important; background-color: #098dd4; } a.kuiButton--primary:not(.kuiButton-isDisabled):hover { /* 1 */ - color: #FFF !important; - /* 1 */ + color: #000 !important; background-color: #098dd4; } .kuiButton--primary:enabled:active { - color: #FFF !important; - /* 1 */ + color: #000 !important; background-color: #098dd4; } a.kuiButton--primary:not(.kuiButton-isDisabled):active { /* 1 */ - color: #FFF !important; - /* 1 */ + color: #000 !important; background-color: #098dd4; } /** * 1. Override Bootstrap. */ .kuiButton--success { - color: #FFF; + color: #000; background-color: #7DE2D1; } .kuiButton--success:not(a):enabled:focus { color: #FFF; } @@ -264,21 +256,21 @@ main { /* 1 */ color: #FFF; } .kuiButton--success:enabled:hover { - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #53d9c2; } a.kuiButton--success:not(.kuiButton-isDisabled):hover { /* 1 */ - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #53d9c2; } .kuiButton--success:enabled:active { - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #53d9c2; } a.kuiButton--success:not(.kuiButton-isDisabled):active { /* 1 */ - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #53d9c2; } @@ -330,7 +322,7 @@ main { * 1. Override Bootstrap. */ .kuiButton--warning { - color: #FFF; + color: #000; background-color: #FFCE7A; } .kuiButton--warning:not(a):enabled:focus { z-index: 1; @@ -352,21 +344,21 @@ main { /* 3 */ color: #FFF; } .kuiButton--warning:enabled:hover { - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #ffbb47; } a.kuiButton--warning:not(.kuiButton-isDisabled):hover { /* 1 */ - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #ffbb47; } .kuiButton--warning:enabled:active { - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #ffbb47; } a.kuiButton--warning:not(.kuiButton-isDisabled):active { /* 1 */ - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #ffbb47; } .kuiButton--warning:disabled { diff --git a/packages/kbn-ui-framework/dist/kui_light.css b/packages/kbn-ui-framework/dist/kui_light.css index f7451a9836ed8..f935e4559fe26 100644 --- a/packages/kbn-ui-framework/dist/kui_light.css +++ b/packages/kbn-ui-framework/dist/kui_light.css @@ -56,10 +56,6 @@ * 4. Fix an IE bug which causes the last child to overflow the container. * 5. Fixing this bug means we now need to align the children to the right. */ -:focus:not([class^="eui"]) { - -webkit-animation: 350ms cubic-bezier(0.694, 0.0482, 0.335, 1) 1 normal forwards focusRingAnimate; - animation: 350ms cubic-bezier(0.694, 0.0482, 0.335, 1) 1 normal forwards focusRingAnimate; } - /** * 1. Required for IE11. */ @@ -235,21 +231,17 @@ main { color: #FFF; } .kuiButton--primary:enabled:hover { color: #FFF !important; - /* 1 */ background-color: #004d81; } a.kuiButton--primary:not(.kuiButton-isDisabled):hover { /* 1 */ color: #FFF !important; - /* 1 */ background-color: #004d81; } .kuiButton--primary:enabled:active { color: #FFF !important; - /* 1 */ background-color: #004d81; } a.kuiButton--primary:not(.kuiButton-isDisabled):active { /* 1 */ color: #FFF !important; - /* 1 */ background-color: #004d81; } /** @@ -330,7 +322,7 @@ main { * 1. Override Bootstrap. */ .kuiButton--warning { - color: #FFF; + color: #000; background-color: #F5A700; } .kuiButton--warning:not(a):enabled:focus { z-index: 1; @@ -352,21 +344,21 @@ main { /* 3 */ color: #FFF; } .kuiButton--warning:enabled:hover { - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #c28400; } a.kuiButton--warning:not(.kuiButton-isDisabled):hover { /* 1 */ - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #c28400; } .kuiButton--warning:enabled:active { - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #c28400; } a.kuiButton--warning:not(.kuiButton-isDisabled):active { /* 1 */ - color: #FFF !important; + color: #000 !important; /* 1 */ background-color: #c28400; } .kuiButton--warning:disabled { diff --git a/packages/kbn-ui-framework/src/components/button/_button.scss b/packages/kbn-ui-framework/src/components/button/_button.scss index 4a15a71328fab..dca1de3cf7ded 100644 --- a/packages/kbn-ui-framework/src/components/button/_button.scss +++ b/packages/kbn-ui-framework/src/components/button/_button.scss @@ -91,7 +91,7 @@ * 1. Override Bootstrap. */ .kuiButton--primary { - color: $buttonDefaultTextColor; + color: chooseLightOrDarkText($buttonPrimaryBackgroundColor, #FFF, #000); background-color: $buttonPrimaryBackgroundColor; @include kuiButtonFocus { @@ -99,7 +99,7 @@ } @include kuiButtonHoverAndActive { - color: $buttonDefaultTextColor !important; /* 1 */ + color: chooseLightOrDarkText($buttonPrimaryHoverBackgroundColor, #FFF, #000) !important /* 1 */; background-color: $buttonPrimaryHoverBackgroundColor; } } @@ -108,7 +108,7 @@ * 1. Override Bootstrap. */ .kuiButton--success { - color: $buttonDefaultTextColor; + color: chooseLightOrDarkText($buttonSuccessBackgroundColor, #FFF, #000); background-color: $buttonSuccessBackgroundColor; @include kuiButtonFocus { @@ -116,7 +116,7 @@ } @include kuiButtonHoverAndActive { - color: $buttonDefaultTextColor !important; /* 1 */ + color: chooseLightOrDarkText($buttonSuccessHoverBackgroundColor, #FFF, #000) !important; /* 1 */ background-color: $buttonSuccessHoverBackgroundColor; } } @@ -144,7 +144,7 @@ * 1. Override Bootstrap. */ .kuiButton--warning { - color: $buttonDefaultTextColor; + color: chooseLightOrDarkText($buttonWarningBackgroundColor, #FFF, #000); background-color: $buttonWarningBackgroundColor; @include kuiButtonFocus { @@ -153,7 +153,7 @@ } @include kuiButtonHoverAndActive { - color: $buttonDefaultTextColor !important; /* 1 */ + color: chooseLightOrDarkText($buttonWarningHoverBackgroundColor, #FFF, #000) !important; /* 1 */ background-color: $buttonWarningHoverBackgroundColor; } diff --git a/x-pack/plugins/ml/public/_variables.scss b/x-pack/plugins/ml/public/_variables.scss index 159a1ffd45dd5..94d79ee2c1540 100644 --- a/x-pack/plugins/ml/public/_variables.scss +++ b/x-pack/plugins/ml/public/_variables.scss @@ -1,8 +1,8 @@ -$mlColorCritical: #fe5050; -$mlColorMajor: #fba740; -$mlColorMinor: #fdec25; -$mlColorWarning: #8bc8fb; -$mlColorUnknown: #c0c0c0; +$mlColorCritical: #DD0A73; +$mlColorMajor: #E2543D; +$mlColorMinor: #FEC514; +$mlColorWarning: #0077CC; +$mlColorUnknown: #535966; $mlColorCriticalText: makeHighContrastColor($mlColorCritical, $euiColorEmptyShade); $mlColorMajorText: makeHighContrastColor($mlColorMajor, $euiColorEmptyShade); diff --git a/x-pack/plugins/ml/public/components/field_data_card/_field_data_card.scss b/x-pack/plugins/ml/public/components/field_data_card/_field_data_card.scss index ee125cd392d18..19063d92639d2 100644 --- a/x-pack/plugins/ml/public/components/field_data_card/_field_data_card.scss +++ b/x-pack/plugins/ml/public/components/field_data_card/_field_data_card.scss @@ -1,44 +1,44 @@ // SASSTODO: This entire sass file needs to be rewritten, using a color blind viz palette and proper vars. -// This will need to be done in a more thorough cleanup. +// This will need to be done in a more thorough cleanup. .ml-field-data-card { width: 360px; height: 435px; .boolean { - background-color: #e6c220; + background-color: $euiColorVis5; } .date { - background-color: #f98510; + background-color: $euiColorVis7; } .document_count { - background-color: #db1374; + background-color: $euiColorVis2; } .geo_point { - background-color: #461a0a; + background-color: $euiColorVis8; } .ip { - background-color: #490092; + background-color: $euiColorVis3; } .keyword { - background-color: #00b3a4; + background-color: $euiColorVis0; } .number { - background-color: #3185fc; + background-color: $euiColorVis1; } .text { - background-color: #920000; + background-color: $euiColorVis9; } .type-other, .unknown { - background-color: #bfa180; + background-color: $euiColorVis6; } // Use euiPanel styling @@ -110,12 +110,12 @@ .x.axis path, .x.axis line { fill: none; - stroke: #cccccc; + stroke: $euiBorderColor; shape-rendering: crispEdges; } .area { - fill: #3185fc; + fill: $euiColorVis1; } } @@ -134,12 +134,12 @@ } .bar { - stroke: #ffffff; + stroke: $euiColorEmptyShade; } .axis path, .axis line { fill: none; - stroke: #cccccc; + stroke: $euiBorderColors; shape-rendering: crispEdges; } } diff --git a/x-pack/plugins/ml/public/components/field_title_bar/_field_title_bar.scss b/x-pack/plugins/ml/public/components/field_title_bar/_field_title_bar.scss index 0fa087deacf91..ce39ada02d141 100644 --- a/x-pack/plugins/ml/public/components/field_title_bar/_field_title_bar.scss +++ b/x-pack/plugins/ml/public/components/field_title_bar/_field_title_bar.scss @@ -1,5 +1,5 @@ .ml-field-title-bar { - color: $euiColorEmptyShade; + color: $euiColorGhost; @include euiFontSizeL; text-align: center; border-radius: $euiBorderRadius $euiBorderRadius 0px 0px; diff --git a/x-pack/plugins/ml/public/components/job_select_list/_job_select_list.scss b/x-pack/plugins/ml/public/components/job_select_list/_job_select_list.scss index 5dc70430d4dbf..660a3b18071dd 100644 --- a/x-pack/plugins/ml/public/components/job_select_list/_job_select_list.scss +++ b/x-pack/plugins/ml/public/components/job_select_list/_job_select_list.scss @@ -4,8 +4,8 @@ // SASSTODO: EXTREMELY DANGEROUS OVERWRITE // Little worried about touching it now navbar { - padding: 10px; - background-color: #EFF0F1; + padding: $euiSizeS; + background: $euiColorLightestShade; } // SASSTODO: EXTREMELY DANGEROUS OVERWRITE @@ -19,13 +19,13 @@ navbar button[disabled] { margin: -9px -14px; .header { - padding: 9px 14px; - border-bottom: 1px solid #eeeeee; + padding: $euiSizeS $euiSize; + border-bottom: $euiBorderThin; } + .footer { - text-align: center; - padding: 9px; - border-top: 1px solid #eee; + padding: $euiSizeS; + border-top: $euiBorderThin; .kuiButton--primary:focus { background-color: #0079a5; @@ -73,11 +73,11 @@ navbar button[disabled] { } .select-list { + @include euiScrollBar; max-height: 400px; overflow-y: auto; overflow-x: hidden; - - background-color: #F5F7FA; + background-color: $euiColorEmptyShade; .list-section-title { margin: 14px; @@ -85,15 +85,15 @@ navbar button[disabled] { } .list-section { - border: 1px solid #e0e0e0; - background-color: #ffffff; - margin: 14px; - margin-top: 5px; - padding: 10px; - border-radius: 3px; + border: $euiBorderThin; + margin: $euiSize; + margin-top: $euiSizeXS; + padding: $euiSizeS; + border-radius: $euiBorderRadius; } + .list-section-single { - margin: -1px; + margin: 0; border-radius: 0px; border: 0px; } @@ -116,40 +116,34 @@ navbar button[disabled] { } .job-row-inner { - display: inline-block; - font-size: 13px; - font-weight: normal; - color: #444444; - white-space: nowrap; + @include euiFontSizeXS; + display: flex; + align-items: center; + justify-content: space-between; + white-space: nowrap; margin: 0px; padding: 0px; - line-height: 20px; // SASSTODO: Replace with proper selector & > label > div { width: 280px; display: inline-block; vertical-align: top; - height: 30px; + height: $euiSizeXL; padding-top: 6px; overflow: hidden; text-overflow: ellipsis; padding-right: 4px; .disabled-job { - color: #cccccc; + color: $euiColorMediumShade; } } // SASSTODO: Replace with proper selector & > label > div:nth-child(2) { width: 310px; - border-left: 1px solid #eee; - border-right: 1px solid #eee; - padding-left: 4px; - padding-top: 6px; - margin-left: -3px; .disabled-job { background-color: #cccccc; @@ -168,8 +162,9 @@ navbar button[disabled] { } .gant-bar { - background-color: #79adda; - height: 14px; + margin-top: $euiSizeXS; + background-color: $euiColorSecondary; + height: $euiSizeS; border-radius: 2px; } @@ -229,15 +224,15 @@ navbar button[disabled] { .gant-back-edge { height: 18px; - border-left: 1px solid #d6d6d6; - border-right: 1px solid #d6d6d6; + border-left: $euiBorderThin; + border-right: $euiBorderThin; margin-bottom: -16px; padding-top: 9px; // SASSTODO: Needs a poper selector div { height: 1px; - border-top: 1px dashed #d6d6d6; + border-top: $euiBorderEditable; } } } @@ -246,7 +241,7 @@ navbar button[disabled] { // SASSTODO: Needs a poper selector & > label > div { - background-color: #f2f2f2; + background-color: $euiColorLightestShade; } } } @@ -274,41 +269,28 @@ navbar button[disabled] { } .ml-job-select-btn-label { - background-color:#9c9c9c; - color: #ffffff; + background: $euiColorMediumShade; + color: chooseLightOrDarkText($euiColorMediumShade, $euiColorGhost, #000); display:inline-block; - padding:0px 10px; - border: 0px solid #ecf0f1; - border-top-style: solid; - border-right-style: none; - border-bottom-style: solid; - border-left-style: solid; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; - height: 34px; - line-height:33px; - font-size: 12px; + padding:0px $euiSizeS; + border-top-left-radius: $euiBorderRadius; + border-bottom-left-radius: $euiBorderRadius; + height: $euiSizeXXL; + line-height: $euiSizeXXL; + font-size: $euiFontSizeXS; } .ml-job-select-btn { - width: 300px; - height: 34px; - text-align: left; - color: #444444; - background-color: white; - border: 1px solid #ffffff; - border-left-width: 0px; - border-radius: 0px 4px 4px 0px; - padding: 6px 16px; - padding-left: 10px; - transition: border-color ease-in-out .15s; - font-size: 14px; - line-height: 20px; - cursor: pointer; + @include euiFormControlStyle; + display: flex; + align-items: center; + justify-content: space-between; .ml-job-select-btn-text { - float: left; width: 260px; + height: $euiSizeXXL; + line-height: $euiSizeXXL; + font-size: $euiFontSizeXS; overflow-x: hidden; display: inline-flex; white-space: nowrap; @@ -321,19 +303,13 @@ navbar button[disabled] { } .caret { - float: right; margin-top: 6px; display:inline-block; } } .ml-job-select-btn:hover, .ml-job-select-btn:focus, .ml-job-select-btn:active { - color: #444444; - background-color: #ffffff; - border-color: #0079a5; - border-left-width: 1px; - padding-left: 9px; - transform: none; + animation: none; } .ml-job-select-btn:focus { diff --git a/x-pack/plugins/ml/public/components/job_select_list/job_select_list.html b/x-pack/plugins/ml/public/components/job_select_list/job_select_list.html index 29b16648c01aa..c328531718b42 100644 --- a/x-pack/plugins/ml/public/components/job_select_list/job_select_list.html +++ b/x-pack/plugins/ml/public/components/job_select_list/job_select_list.html @@ -129,7 +129,7 @@ >