Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] feat: high contrast CSS with color adjustments to pass WCAG requirements #3862

Merged
merged 4 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"compile:esm": "tsc -p ./src",
"compile:cjs": "tsc -p ./src -m commonjs --outDir lib/cjs",
"compile:esnext": "tsc -p ./src -t esnext --outDir lib/esnext",
"compile:css": "sass-compile ./src --functions ./scripts/sass-inline-svg.js",
"compile:css": "sass-compile ./src --functions ./scripts/sass-custom-functions.js",
"dev": "run-p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
"dist": "run-s \"dist:*\"",
"dist:bundle": "cross-env NODE_ENV=production webpack",
Expand Down
32 changes: 32 additions & 0 deletions packages/core/scripts/sass-custom-functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2019 Palantir Technologies, Inc. All rights reserved.
*
* 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.
*/

const inliner = require("sass-inline-svg");

module.exports = {
/**
* Sass function to inline a UI icon svg and change its path color.
*
* Usage:
* svg-icon("16px/icon-name.svg", (path: (fill: $color)) )
*/
"svg-icon": inliner("../../resources/icons", {
// run through SVGO first
optimize: true,
// minimal "uri" encoding is smaller than base64
encodingFormat: "uri"
}),
};
12 changes: 0 additions & 12 deletions packages/core/scripts/sass-inline-svg.js

This file was deleted.

22 changes: 22 additions & 0 deletions packages/core/src/accessibility/blueprint-hi-contrast.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*!

Copyright 2019-present Palantir Technologies, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0.

*/

// override some intent colors to pass contrast requirements
$pt-intent-primary: #106ba3 !default; // $blue2
$pt-intent-success: #0d8050 !default; // $green2;
$pt-intent-warning: #a66321 !default; // $orange1;
$pt-intent-danger: #c23030 !default; // $red2;

// Import files in the same order that they are documented in the docs
@import "../common/variables";
@import "../common/colors";

@import "../reset";
@import "../typography";
@import "./focus-states";

@import "../components/index";
2 changes: 1 addition & 1 deletion packages/core/src/blueprint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Licensed under the Apache License, Version 2.0.

@import "reset";
@import "typography";
@import "accessibility";
@import "accessibility/focus-states";

@import "components/index";
2 changes: 1 addition & 1 deletion packages/docs-app/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Licensed under the Apache License, Version 2.0.
@import "~normalize.css/normalize.css";

// import these first because they're the base layer
@import "~@blueprintjs/core/lib/css/blueprint.css";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be reverted

@import "~@blueprintjs/core/lib/css/accessibility/blueprint-hi-contrast.css";
@import "~@blueprintjs/datetime/lib/css/blueprint-datetime.css";
@import "~@blueprintjs/icons/lib/css/blueprint-icons.css";
@import "~@blueprintjs/select/lib/css/blueprint-select.css";
Expand Down