Giter Club home page Giter Club logo

Comments (4)

liamdebeasi avatar liamdebeasi commented on May 5, 2024

We likely need to adjust the --ion-border-color value (or similar) for items in lists. I can reproduce the same behavior in Ionic 7: https://stackblitz.com/edit/motuzy-kmn4fz?file=package.json,src%2Fmain.ts,src%2Ftheme%2Fvariables.css,src%2Fenv.d.ts

The accordion has this problem because it has color="light" and we use the shade variant for the border.

from ionic-framework.

aparajita avatar aparajita commented on May 5, 2024

Thanks for taking a look.

from ionic-framework.

liamdebeasi avatar liamdebeasi commented on May 5, 2024

Here's a dev build that should fix the contrast issue for Items without the color property: 8.0.1-dev.11713911458.1ad5f4cf

I'll need to take a closer look at how best to handle the case where color is set. For most colors in the palette, using the shade for the border is fine since we lighten the base color in dark mode. This is not the case for the light color in dark mode (and similarly, the dark color in light mode) since the base color actually gets darker.

from ionic-framework.

liamdebeasi avatar liamdebeasi commented on May 5, 2024

Thanks for the issue. This has been resolved via #29398, and a fix will be available in an upcoming release of Ionic Framework. This PR fixes the issue where the wrong border color was used on an item without the color prop in dark mode.

The other issue is a bit tricky to automatically solve for every use case. In some cases we need to use the tint for the border color, and in others we need to use the shade. This decision needs to be based on color contrast which we don't have a great way of automatically determining at runtime. Ideally we'd be able to use color-contrast which would choose the value that yields the higher contrast. However, the browser support for this is limited to Safari 15+ as of writing.

As browser support improves for color-contrast we'll be happy to consider adding support for this automatically. Here is a workaround you can implement in your application to resolve the issue for now:

@media (prefers-color-scheme: dark) {
  ion-item.ion-color-light::part(native) {
    border-color: var(--ion-color-tint);
  }
}

from ionic-framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.