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

Provide option to set inverse text colour [wip] #178

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module.exports = function(eleventyConfig) {
| Name | Type | Description |
| :--- | :--- | :---------- |
| **brandColour** | string | Override default value for `$govuk-brand-colour`. Must be a hex value (i.e. `#1d70b8`). |
| **inverseTextColour** | string | Override default value for `$govuk-inverse-text-colour`. Must be a hex value (i.e. `#fff`). |
| **fontFamily** | string | Override default value for `$govuk-font-family`. Must be a list of one or more font family names (i.e. `"GDS Transport", arial, sans-serif`).
| **assetsPath** | string | Override default value for `$govuk-assets-path`. |
| **fontsPath** | string | Override default value for `$govuk-fonts-path`. |
Expand Down
1 change: 1 addition & 0 deletions lib/data/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const deepmerge = require('deepmerge')
*/
const defaultOptions = {
brandColour: false,
inverseTextColour: false,
themeColour: '#0b0c0c', // $govuk-text-colour
fontFamily: false,
icons: {
Expand Down
3 changes: 2 additions & 1 deletion lib/events/generate-govuk-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { ensureSlash } = require('../utils.js')
* @returns {function}
*/
module.exports = async function (dir, pathPrefix, options) {
const { imagesPath, fontsPath, brandColour, fontFamily } = options
const { inverseTextColour, imagesPath, fontsPath, brandColour, fontFamily } = options
const assetsPath = options.assetsPath || path.join(pathPrefix, 'assets')

// Get plugin options and set GOV.UK Frontend variables if provided
Expand All @@ -26,6 +26,7 @@ module.exports = async function (dir, pathPrefix, options) {
fontsPath ? `$govuk-fonts-path: "${ensureSlash(fontsPath)}";` : [],
imagesPath ? `$govuk-images-path: "${ensureSlash(imagesPath)}";` : [],
brandColour ? `$govuk-brand-colour: ${brandColour};` : [],
inverseTextColour ? `$govuk-inverse-text-colour: ${inverseTextColour};` : [],
fontFamily ? `$govuk-font-family: ${fontFamily};` : [],
inputFile
].join('\n')
Expand Down
2 changes: 1 addition & 1 deletion lib/govuk.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $govuk-new-link-styles: true;
$govuk-global-styles: true;

// GOV.UK Frontend
@import "node_modules/govuk-frontend/govuk/all";
@import "node_modules/govuk-frontend/dist/govuk/all";

// GOV.UK Prototype components
@import "node_modules/@x-govuk/govuk-prototype-components/x-govuk/all";
Expand Down
2 changes: 1 addition & 1 deletion lib/nunjucks.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = (eleventyConfig) => {

const searchPaths = [
'./node_modules/@x-govuk/govuk-eleventy-plugin',
resolveNpmModule('govuk-frontend'),
path.join(resolveNpmModule('govuk-frontend'), 'dist'),
resolveNpmModule('@x-govuk/govuk-prototype-components'),
...(includes ? [path.join(input, includes)] : []),
...(layouts ? [path.join(input, layouts)] : []),
Expand Down
55 changes: 47 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
"@11ty/eleventy-plugin-rss": "^1.1.2",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@x-govuk/govuk-prototype-components": "^2.0.0",
"@x-govuk/govuk-prototype-components": "x-govuk/govuk-prototype-components#govuk-frontend-inverse",
"deepmerge": "^4.2.2",
"govuk-frontend": "^4.3.0",
"govuk-frontend": "x-govuk/govuk-frontend#preview-inverse-colour-improvements",
"luxon": "^3.0.1",
"markdown-it-abbr": "^1.0.4",
"markdown-it-anchor": "^8.4.1",
Expand Down