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

Updated CSS Heading Color Palette #3371

Merged
merged 2 commits into from
Jan 21, 2025
Merged
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
22 changes: 15 additions & 7 deletions docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,26 @@
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
{
docs: {
sidebarPath: './sidebars.ts',
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
sidebarPath: require.resolve('./sidebars.js'),
editUrl: ({ docPath }) => {
return `https://github.com/PalisadoesFoundation/talawa-admin/edit/develop/docs/docs/${docPath}`;

Check warning on line 38 in docs/docusaurus.config.ts

View check run for this annotation

Codecov / codecov/patch

docs/docusaurus.config.ts#L38

Added line #L38 was not covered by tests
},
},
blog: {
showReadingTime: true,
editUrl:
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
'https://github.com/PalisadoesFoundation/talawa-admin/tree/develop/docs/docs',
},
theme: {
customCss: './src/css/custom.css',
customCss: [
require.resolve('./src/css/custom.css'),
require.resolve('./src/css/index.css'),
],
},
} satisfies Preset.Options,
},
],
],

Expand Down Expand Up @@ -76,7 +84,7 @@
{
label: 'Admin Guide',
position: 'left',
href: 'https://docs-admin.talawa.io/docs',
href: '/docs',
target: '_self',
},
{
Expand Down
27 changes: 27 additions & 0 deletions docs/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
*/

:root {
--h1-markdown: #021526;
--h2-markdown: #3a6d8c;
--h3-markdown: #474e93;
--h4-markdown: #508c9b;
--h5-markdown: #6a9ab0;
--h6-markdown: #888888;
--hx-markdown-underline: #eeeeee;
Comment on lines +9 to +15
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Confirmed accessibility issues with heading colors

The current heading colors are problematic:

  • Heading colors are defined globally without theme-specific variations
  • Current colors have insufficient contrast against dark theme background (#111927)
  • Colors appear to be designed for light theme but are being applied to dark theme as well

Recommendations:

  • Define separate color variables for light and dark themes
  • Use CSS selectors like html[data-theme='dark'] to override colors for dark theme
  • Ensure contrast ratios meet WCAG standards (4.5:1 for normal text, 3:1 for large text)
🔗 Analysis chain

Consider color contrast ratios for accessibility.

While the color palette is aesthetically pleasing, ensure that all heading colors meet WCAG 2.1 contrast requirements (4.5:1 for normal text, 3:1 for large text) against the background color.

Run the following to check color contrast ratios:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Extract and analyze color values for WCAG contrast compliance
# Note: This is a basic check. Use a dedicated tool for thorough testing.

echo "Background color:"
rg -l "background-color.*#" | xargs rg "background-color.*#"

echo "\nHeading colors:"
rg "h[1-6]-markdown.*#" custom.css

Length of output: 5969


Script:

#!/bin/bash
# Search for theme-specific styles and content area backgrounds
echo "Theme and content area styles:"
rg -A 2 "html\[data-theme" docs/src/css/custom.css

echo "\nMarkdown content styles:"
rg "markdown|content.*background|main.*background" docs/src/css/custom.css

Length of output: 1205


Script:

#!/bin/bash
# Search for light theme background and any theme-specific heading color overrides
echo "Light theme and default styles:"
rg "(\[data-theme='light'\]|:root.*{)" -A 5 docs/src/css/custom.css

echo "\nAny theme-specific heading overrides:"
rg "\[data-theme.*\].*h[1-6]" docs/src/css/custom.css

Length of output: 441


Script:

#!/bin/bash
# Search for root styles and theme configurations
echo "Root styles:"
rg ":root" -A 10 docs/src/css/custom.css

echo "\nLight theme styles:"
rg "data-theme='light'" -A 5 docs/src/css/custom.css

echo "\nDefault background color:"
rg "^[[:space:]]*--ifm-background-color:" docs/src/css/custom.css

Length of output: 654

--secondary-blue-900: #001c63;
--sidebar-bg-color: #f3f4f6;
--secondary-blue-500: #3970fd;
Expand Down Expand Up @@ -119,12 +126,32 @@ h1.docTitle_node_modules-\@docusaurus-theme-classic-src-theme-DocItem- {
--ifm-h2-font-size: 1.875rem;
margin-bottom: 0.8rem;
margin-top: calc(var(--ifm-h2-vertical-rhythm-top) * 0rem);
color: var(--h2-markdown);
border-bottom: 1px solid var(--hx-markdown-underline);
padding-bottom: 5px;
}

.markdown > h3 {
--ifm-h3-font-size: 1.5rem;
margin-bottom: 0.8rem;
margin-top: calc(var(--ifm-h3-vertical-rhythm-top) * 0rem);
color: var(--h3-markdown);
border-bottom: 1px solid var(--hx-markdown-underline);
padding-bottom: 5px;
}

.markdown > h4 {
color: var(--h4-markdown);
border-bottom: 1px solid var(--hx-markdown-underline);
padding-bottom: 5px;
}

.markdown > h5 {
color: var(--h5-markdown);
}

.markdown > h6 {
color: var(--h6-markdown);
}

.navbar {
Expand Down
Loading
Loading