-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Bootstrap 5 upgrade without theme feature. #1037
base: main
Are you sure you want to change the base?
Bootstrap 5 upgrade without theme feature. #1037
Conversation
No. I am looking into this now. It could be browser specific. I am reviewing the rules in style.css; the old rules definitely need a bit of modification due to a new Bootstrap 5 rule for tables: .table>:not(caption)>*>* {
padding: .5rem .5rem;
color: var(--bs-table-color-state,var(--bs-table-color-type,var(--bs-table-color)));
background-color: var(--bs-table-bg);
border-bottom-width: var(--bs-border-width);
box-shadow: inset 0 0 0 9999px var(--bs-table-bg-state,var(--bs-table-bg-type,var(--bs-table-accent-bg)))
}
|
…ting relative CSS colors.
FindingsIt does appear to be a browser compatibility issue with only Firefox for relative colors: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb#browser_compatibility I went ahead and put back the original default colors into return new self('#dff0d8', '#c3e3b5', '#99cb84', '#fcf8e3', '#f2dede'); The theme friendly rules can still be applied as environment variables: <html outputDirectory="output/html" lowUpperBound="50" highLowerBound="90"
colorSuccessLow="rgb(from var(--bs-purple) r g b / 0.75)"
colorSuccessMedium="rgb(from var(--bs-blue) r g b / 0.55)"
colorSuccessHigh="rgb(from var(--bs-teal) r g b / 0.25)"
colorWarning="rgb(from var(--bs-warning) r g b / 0.25)"
colorDanger="rgb(from var(--bs-danger) r g b / 0.25)" /> NOTE: Mozilla has approved relative colors, but it has not made it into Firefox yet: |
No problem, happy to help! And no, those changes are not intentional. In this case, the Bootstrap 5 rules are taking precedence with the use of: .bg-success {
--bs-bg-opacity: 1;
background-color: rgba(var(--bs-success-rgb),var(--bs-bg-opacity)) !important;
}
|
Findings for progress-bar background colorsSo it looks like the optional colors have never overridden the progress-bar. Bootstrap 4 just used a lighter color for .bg-success {
background-color: #28a745 !important;
} I was experimenting with some rules to allow the progress bars to override colors. This is what it would look like with Bootstrap 4 and the override colors, which is not ideal: I have a few more things I can try, but a final solution might require the usage of themes along with |
Proposed changes (without data-bs-theme feature)Sorry for so much info in this post
In this last pass, I added root variables for /* :root {
--phpunit-success-bar: #28a745;
--phpunit-success-high: #99cb84;
--phpunit-success-medium: #c3e3b5;
--phpunit-success-low: #dff0d8;
--phpunit-warning: #fcf8e3;
--phpunit-warning-bar: #ffc107;
--phpunit-danger: #f2dede;
--phpunit-danger-bar: #dc3545;
} */
:root {
--phpunit-success-bar: #28a745;
--phpunit-success-high: {{success-high}};
--phpunit-success-medium: {{success-medium}};
--phpunit-success-low: {{success-low}};
--phpunit-warning: {{warning}};
--phpunit-warning-bar: #ffc107;
--phpunit-danger: {{danger}};
--phpunit-danger-bar: #dc3545;
}
What is different in style.css1. Lists and columns.table tbody tr.covered-by-large-tests, .table tbody tr.covered-by-large-tests td, li.covered-by-large-tests, tr.success, tr.success td, td.success, li.success, span.success {
background-color: var(--phpunit-success-low);
}
.table tbody tr.covered-by-medium-tests, .table tbody tr.covered-by-medium-tests td, li.covered-by-medium-tests {
background-color: var(--phpunit-success-medium);
}
.table tbody tr.covered-by-small-tests, .table tbody tr.covered-by-small-tests td, li.covered-by-small-tests {
background-color: var(--phpunit-success-high);
}
.table tbody tr.warning, .table tbody tr.warning td, .table tbody td.warning, li.warning, span.warning {
background-color: var(--phpunit-warning);
}
.table tbody tr.danger, .table tbody tr.danger td, .table tbody td.danger, li.danger, span.danger {
background-color: var(--phpunit-danger);
} 2. Covered, Not Covered and Not Coverable.covered-by-small-tests {
background-color: var(--phpunit-success-high);
}
.covered-by-medium-tests {
background-color: var(--phpunit-success-medium);
}
.covered-by-large-tests {
background-color: var(--phpunit-success-low);
}
.not-covered {
background-color: var(--phpunit-danger);
}
.not-coverable {
background-color: var(--phpunit-warning);
} 3. Progress BarsThis is the part the required the fix Typically, we try to avoid using .progress-bar.bg-success {
background-color: var(--phpunit-success-bar) !important;
}
.progress-bar.bg-warning {
background-color: var(--phpunit-warning-bar) !important;
}
.progress-bar.bg-danger {
background-color: var(--phpunit-danger-bar) !important;
} How to override the rules in the customCssFile:These :root {
--phpunit-success-bar: rgba(var(--bs-success-rgb), 1);
--phpunit-success-high: rgba(var(--bs-success-rgb), 0.67);
--phpunit-success-medium: rgba(var(--bs-success-rgb), 0.33);
--phpunit-success-low: rgba(var(--bs-success-rgb), 0.1);
--phpunit-warning: rgba(var(--bs-warning-rgb), 0.1);
--phpunit-warning-bar: rgba(var(--bs-warning-rgb), 1);
--phpunit-danger: rgba(var(--bs-danger-rgb), 0.1);
--phpunit-danger-bar: rgba(var(--bs-danger-rgb), 1);
}
How it looks in the browserThis section shows the way the UI works with the commit:
The examples showing dark mode were manually edited in the browser: <html lang="en" data-bs-theme="dark"> Expand the four screenshots: 1. Firefox with CSS VarsThis is the latest changes in style.css. A few more CSS rules were added it the end to make the progress bars match. 2. Firefox with Dark Theme enabledThis is here just to show that the variables need to be overridden to support themes. Tests
|
Changes