diff --git a/web/vtadmin/src/fonts/LICENSE_OFL.txt b/web/vtadmin/src/fonts/LICENSE_OFL.txt new file mode 100644 index 00000000000..d952d62c065 --- /dev/null +++ b/web/vtadmin/src/fonts/LICENSE_OFL.txt @@ -0,0 +1,92 @@ +This Font Software is licensed under the SIL Open Font License, +Version 1.1. + +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font +creation efforts of academic and linguistic communities, and to +provide a free and open framework in which fonts may be shared and +improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply to +any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software +components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, +deleting, or substituting -- in part or in whole -- any of the +components of the Original Version, by changing formats or by porting +the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, +modify, redistribute, and sell modified and unmodified copies of the +Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in +Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the +corresponding Copyright Holder. This restriction only applies to the +primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created using +the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/web/vtadmin/src/fonts/NotoMono-Regular.ttf b/web/vtadmin/src/fonts/NotoMono-Regular.ttf new file mode 100644 index 00000000000..3560a3a0c87 Binary files /dev/null and b/web/vtadmin/src/fonts/NotoMono-Regular.ttf differ diff --git a/web/vtadmin/src/fonts/NotoSans-Bold.ttf b/web/vtadmin/src/fonts/NotoSans-Bold.ttf new file mode 100644 index 00000000000..1db7886e948 Binary files /dev/null and b/web/vtadmin/src/fonts/NotoSans-Bold.ttf differ diff --git a/web/vtadmin/src/fonts/NotoSans-Regular.ttf b/web/vtadmin/src/fonts/NotoSans-Regular.ttf new file mode 100644 index 00000000000..0a01a062f01 Binary files /dev/null and b/web/vtadmin/src/fonts/NotoSans-Regular.ttf differ diff --git a/web/vtadmin/src/fonts/NotoSans-SemiBold.ttf b/web/vtadmin/src/fonts/NotoSans-SemiBold.ttf new file mode 100644 index 00000000000..8b7fd13026e Binary files /dev/null and b/web/vtadmin/src/fonts/NotoSans-SemiBold.ttf differ diff --git a/web/vtadmin/src/index.css b/web/vtadmin/src/index.css index 515d87a9553..e569c705fba 100644 --- a/web/vtadmin/src/index.css +++ b/web/vtadmin/src/index.css @@ -1,5 +1,5 @@ /** - * Copyright 2020 The Vitess Authors. + * Copyright 2021 The Vitess Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,28 +13,51 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@import "./style/fonts.css"; + :root { - --primaryForegroundRGB: 29, 28, 29; - --primaryForeground: rgb(var(--primaryForegroundRGB)); - --invertedForegroundRGB: 255, 255, 255; - --invertedForeground: rgb(var(--invertedForegroundRGB)); - --primaryBackgroundRGB: 255, 255, 255; - --primaryBackground: rgb(var(--primaryBackgroundRGB)); - - /* Grayscale */ - --maxContrastGray: rgba(var(--primaryForegroundRGB), 0.7); - --highContrastGray: rgba(var(--primaryForegroundRGB), 0.5); - --lowContrastGray: rgba(var(--primaryForegroundRGB), 0.13); - --minContrastGray: rgba(var(--primaryForegroundRGB), 0.04); -} + /* Greyscale */ + --grey75: #fafafa; + --grey200: #edf2f7; + --grey400: #cbd5e0; + --grey600: #718096; + --grey800: #2d3748; + --grey900: #1e2531; -body { - background: var(--primaryBackground); - color: var(--primaryForeground); - margin: 0; - font-family: + /* Invariant colours common across all themes */ + --colorSuccess: #00893e; + --colorSuccess50: #4cba6a; + --colorSuccess200: #005a13; + --colorInfo: #ffab40; + --colorInfo50: #ffdd71; + --colorInfo200: #c77c02; + --colorError: #d32f2f; + --colorError50: #ff6659; + --colorError200: #9a0007; + + /* Light theme colour palette */ + --background_light: #fff; + --colorPrimary_light: #3d5afe; + --colorPrimary50_light: #8187ff; + --colorPrimary200_light: #0031ca; + --textColorPrimary_light: #17171b; + --textColorSecondary_light: #718096; + --textColorDisabled_light: #cbd5e0; + + /* Dark theme colour palette */ + --background_dark: #17171b; + --colorPrimary_dark: #8187ff; + --colorPrimary50_dark: #b6b7ff; + --colorPrimary200_dark: #4a5acb; + --textColorPrimary_dark: #fff; + --textColorSecondary_dark: #cbd5e0; + --textColorDisabled_dark: #2d3748; + + /* Fonts */ + --fontFamilyPrimary: + 'NotoSans', -apple-system, - BlinkMacSystemFont, + blinkmacsystemfont, 'Segoe UI', 'Roboto', 'Oxygen', @@ -44,15 +67,86 @@ body { 'Droid Sans', 'Helvetica Neue', sans-serif; + --fontFamilyMonospace: 'NotoMono', source-code-pro, menlo, monaco, consolas, 'Courier New', monospace; + + /* Body text */ + --fontSizeDefault: 1.5rem; + --fontSizeLarge: 1.7rem; + --fontSizeSmall: 1.3rem; + --lineHeightBody: 1.36; + + /* Headings */ + --fontSizeHeading1: 3.6rem; + --fontSizeHeading2: 2.8rem; + --fontSizeHeading3: 2rem; + --lineHeightHeading: 1.36; + + /* Layout variables, set to light theme by default */ + --backgroundPrimary: var(--background_light); + --tableBorderColor: var(--grey400); + --textColorPrimary: var(--textColorPrimary_light); + --textColorSecondary: var(--textColorSecondary_light); + --textColorDisabled: var(--textColorDisabled_light); +} + +/* Dark theme */ +[data-vtadmin-theme="dark"] { + --backgroundPrimary: var(--background_dark); + --tableBorderColor: var(--grey800); + --textColorPrimary: var(--textColorPrimary_dark); + --textColorSecondary: var(--textColorSecondary_dark); + --textColorDisabled: var(--textColorDisabled_dark); +} + +html { + /** + * Set a base font size of 1rem == 10px, based on the common browser default of 16px. + * This lets us use rem values everywhere for accessibility, while still + * "pinning" to reasonable defaults. For a really good article on this, + * see https://www.24a11y.com/2019/pixels-vs-relative-units-in-css-why-its-still-a-big-deal/ + */ + font-size: 62.5%; +} + +body { + background: var(--backgroundPrimary); + color: var(--textColorPrimary); + font-size: var(--fontSizeDefault); + line-height: var(--lineHeightBody); + margin: 0; + font-family: var(--fontFamilyPrimary); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } +/* Typography */ +h1 { + color: var(--textColorPrimary); + font-size: var(--fontSizeHeading1); + font-weight: 700; + line-height: var(--lineHeightHeading); +} + +h2 { + color: var(--textColorPrimary); + font-size: var(--fontSizeHeading2); + font-weight: 700; + line-height: var(--lineHeightHeading); +} + +h3 { + color: var(--textColorPrimary); + font-size: var(--fontSizeHeading3); + font-weight: 700; + line-height: var(--lineHeightHeading); +} + code { - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; - font-size: 0.9em; + font-family: var(--fontFamilyMonospace); + font-size: var(--fontSizeDefault); } +/* Tables */ table { border-collapse: collapse; width: 100%; @@ -63,6 +157,6 @@ table th { } table tbody td { - border: solid 1px var(--lowContrastGray); + border: solid 1px var(--tableBorderColor); padding: 12px; } diff --git a/web/vtadmin/src/style/fonts.css b/web/vtadmin/src/style/fonts.css new file mode 100644 index 00000000000..abf3bdb92f4 --- /dev/null +++ b/web/vtadmin/src/style/fonts.css @@ -0,0 +1,40 @@ +/** + * Copyright 2021 The Vitess Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@font-face { + font-display: swap; + font-family: 'NotoSans'; + src: local('NotoSans-Regular'), url('../fonts/NotoSans-Regular.ttf') format('truetype'); +} + +@font-face { + font-display: swap; + font-family: 'NotoSans'; + src: local('NotoSans-SemiBold'), url('../fonts/NotoSans-SemiBold.ttf') format('truetype'); + font-weight: 500; +} + +@font-face { + font-display: swap; + font-family: 'NotoSans'; + src: local('NotoSans-Bold'), url('../fonts/NotoSans-Bold.ttf') format('truetype'); + font-weight: 700; +} + +@font-face { + font-display: swap; + font-family: 'NotoMono'; + src: local('NotoMono-Regular'), url('../fonts/NotoMono-Regular.ttf') format('truetype'); +}