Adding Background Color to Tables with Page Wrapper Variables

Created on 10 February 2024, 11 months ago
Updated 27 June 2024, 6 months ago

Problem/Motivation

First, thanks for all the work!

Problem: Shading on alternate table rows is not applied.

Steps to reproduce

Entered "solo-table-all" in View, Advanced, Other, CSS class.

Proposed resolution

I got it to work by adding --solo-odd to solo-variables.css (--solo-even is there by odd is missing).

And commenting code in the following section of solo-variables-regions.css.

/*.page-wrapper table,
.page-wrapper tr,
.page-wrapper td,
.page-wrapper th, */
.page-wrapper hr,
.page-wrapper ul,
.page-wrapper li {
border-color: var(--r-br, var(--r-br-b));
background-color: var(--r-bg);
color: var(--r-tx);
}

πŸ’¬ Support request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Nancy Cole Boston

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Nancy Cole
  • Assigned to flashwebcenter
  • Status changed to Fixed 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    You're welcome, I'm glad to help!

    The .solo-table-all class is specifically tied to the table tag within the views-view-table.html.twig file of the Solo template. The classes for the even and odd rows haven't been defined, which is why you're not seeing the alternate shading. You can, however, use the provided page-wrapper variables to create this effect.

    For those with a sub-theme, you can add the following CSS to achieve the desired shading:

    .solo-table-all tr:nth-child(even) {
      --r-bg: #f0f2f5;
    }
    .solo-table-all tr:nth-child(odd) {
      --r-bg: #dce0e7;
    }
    .solo-table-all th {
      --r-bg: #262d38;
      --r-tx: #f0f2f5;
    }

    If you're not using a sub-theme, navigate to your-site/admin/appearance/settings/solo, click on "Global Sites", and then paste the above CSS into the "CSS Injector" field.

    This will apply the appropriate background colors to your table rows and headers, creating a visually distinct pattern for even and odd rows.

    Best wishes,
    Alaa

  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    I've introduced three variables to customize table backgrounds within the theme. These can be adjusted through Solo settings at your-site.com/admin/appearance/settings/solo. Navigate to "Global Site" and then use the CSS Injector to tailor these variables as desired:
    #page-wrapper { --solo-odd: white; --solo-even: #f1f1f1; --solo-thead: gray; }

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX
Production build 0.71.5 2024