Respect preferred color scheme in docs (#1241)

This commit is contained in:
Lukas 2022-10-08 10:53:42 +02:00 committed by GitHub
parent 5365d51b12
commit 34419ae521
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@ const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula'); const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const path = require('path'); const path = require('path');
/** @type {import('@docusaurus/types').DocusaurusConfig} */ /** @type {import('@docusaurus/types').Config} */
module.exports = { module.exports = {
title: 'Woodpecker CI', title: 'Woodpecker CI',
tagline: 'Woodpecker is a simple CI engine with great extensibility.', tagline: 'Woodpecker is a simple CI engine with great extensibility.',
@ -14,130 +14,135 @@ module.exports = {
organizationName: 'woodpecker-ci', organizationName: 'woodpecker-ci',
projectName: 'woodpecker-ci.github.io', projectName: 'woodpecker-ci.github.io',
trailingSlash: false, trailingSlash: false,
themeConfig: { themeConfig:
navbar: { /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
title: 'Woodpecker', ({
logo: { navbar: {
alt: 'Woodpecker Logo', title: 'Woodpecker',
src: 'img/logo.svg', logo: {
alt: 'Woodpecker Logo',
src: 'img/logo.svg',
},
items: [
{
to: 'docs/intro',
activeBaseRegex: 'docs/(?!migrations|awesome)',
position: 'left',
label: 'Docs',
},
{
to: '/plugins',
position: 'left',
label: 'Plugins',
},
{
to: '/docs/migrations',
activeBaseRegex: 'docs/migrations',
position: 'left',
label: 'Migrations',
},
{
to: '/faq',
position: 'left',
label: 'FAQ',
},
{
to: '/docs/awesome',
position: 'left',
label: 'Awesome',
},
{
type: 'docsVersionDropdown',
position: 'right',
},
{
href: 'https://github.com/woodpecker-ci/woodpecker',
position: 'right',
className: 'header-github-link',
'aria-label': 'GitHub repository',
},
{
label: '🧡 Sponsor Us',
position: 'right',
href: 'https://opencollective.com/woodpecker-ci',
},
],
}, },
items: [ footer: {
{ style: 'dark',
to: 'docs/intro', links: [
activeBaseRegex: 'docs/(?!migrations|awesome)', {
position: 'left', title: 'Docs',
label: 'Docs', items: [
}, {
{ label: 'Usage',
to: '/plugins', to: '/docs/usage/intro',
position: 'left', },
label: 'Plugins', {
}, label: 'Server setup',
{ to: '/docs/administration/setup',
to: '/docs/migrations', },
activeBaseRegex: 'docs/migrations', {
position: 'left', label: 'FAQ',
label: 'Migrations', to: '/faq',
}, },
{ ],
to: '/faq', },
position: 'left', {
label: 'FAQ', title: 'Community',
}, items: [
{ {
to: '/docs/awesome', label: 'Discord',
position: 'left', href: 'https://discord.gg/fcMQqSMXJy',
label: 'Awesome', },
}, {
{ label: 'Matrix',
type: 'docsVersionDropdown', href: 'https://matrix.to/#/#woodpecker:matrix.org',
position: 'right', },
}, {
{ label: 'Mastodon',
href: 'https://github.com/woodpecker-ci/woodpecker', href: 'https://mastodon.technology/@WoodpeckerCI',
position: 'right', },
className: 'header-github-link', ],
'aria-label': 'GitHub repository', },
}, {
{ title: 'More',
label: '🧡 Sponsor Us', items: [
position: 'right', {
href: 'https://opencollective.com/woodpecker-ci', label: 'Translate',
}, href: 'https://translate.woodpecker-ci.org/engage/woodpecker-ci/',
], },
}, {
footer: { label: 'GitHub',
style: 'dark', href: 'https://github.com/woodpecker-ci/woodpecker',
links: [ },
{ {
title: 'Docs', href: 'https://ci.woodpecker-ci.org/woodpecker-ci/woodpecker',
items: [ label: 'CI',
{ },
label: 'Usage', ],
to: '/docs/usage/intro', },
}, ],
{ copyright: `Copyright © ${new Date().getFullYear()} Woodpecker CI. Built with Docusaurus.`,
label: 'Server setup', },
to: '/docs/administration/setup', prism: {
}, theme: lightCodeTheme,
{ darkTheme: darkCodeTheme,
label: 'FAQ', },
to: '/faq', announcementBar: {
}, id: 'github-star',
], content: ` If you like Woodpecker-CI, <a href=https://github.com/woodpecker-ci/woodpecker rel="noopener noreferrer" target="_blank">give us a star on GitHub</a> ! ⭐️`,
}, backgroundColor: 'var(--ifm-color-primary)',
{ textColor: 'var(--ifm-color-gray-900)',
title: 'Community', },
items: [ tableOfContents: {
{ minHeadingLevel: 2,
label: 'Discord', maxHeadingLevel: 4,
href: 'https://discord.gg/fcMQqSMXJy', },
}, colorMode: {
{ respectPrefersColorScheme: true,
label: 'Matrix', },
href: 'https://matrix.to/#/#woodpecker:matrix.org', }),
},
{
label: 'Mastodon',
href: 'https://mastodon.technology/@WoodpeckerCI',
},
],
},
{
title: 'More',
items: [
{
label: 'Translate',
href: 'https://translate.woodpecker-ci.org/engage/woodpecker-ci/',
},
{
label: 'GitHub',
href: 'https://github.com/woodpecker-ci/woodpecker',
},
{
href: 'https://ci.woodpecker-ci.org/woodpecker-ci/woodpecker',
label: 'CI',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Woodpecker CI. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
announcementBar: {
id: 'github-star',
content: ` If you like Woodpecker-CI, <a href=https://github.com/woodpecker-ci/woodpecker rel="noopener noreferrer" target="_blank">give us a star on GitHub</a> ! ⭐️`,
backgroundColor: 'var(--ifm-color-primary)',
textColor: 'var(--ifm-color-gray-900)',
},
tableOfContents: {
minHeadingLevel: 2,
maxHeadingLevel: 4,
},
},
plugins: [ plugins: [
() => ({ () => ({
name: 'docusaurus-plugin-favicon', name: 'docusaurus-plugin-favicon',
@ -177,7 +182,8 @@ module.exports = {
presets: [ presets: [
[ [
'@docusaurus/preset-classic', '@docusaurus/preset-classic',
{ /** @type {import('@docusaurus/preset-classic').Options} */
({
docs: { docs: {
sidebarPath: require.resolve('./sidebars.js'), sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/woodpecker-ci/woodpecker/edit/master/docs/', editUrl: 'https://github.com/woodpecker-ci/woodpecker/edit/master/docs/',
@ -197,7 +203,7 @@ module.exports = {
theme: { theme: {
customCss: require.resolve('./src/css/custom.css'), customCss: require.resolve('./src/css/custom.css'),
}, },
}, }),
], ],
], ],
webpack: { webpack: {