Giter Club home page Giter Club logo

platform-colors's People

Contributors

asherlzr avatar danilobuerger avatar moquez avatar oblador avatar ottosichert avatar pontusab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

platform-colors's Issues

Platform specific colors

Is it possible to make a platform specific color declaration which points to another native color value? Suppose I want to use the native labelColor on iOS but fallback to #000/#FFF on web.

I guess src/colors with some Platform.select to handle these cases would work but it would also bloat the catalog with unused colors and would be kind of cumbersome.

Get resolved color for current scheme in javascript land

Motivation:

Some features of rn don't currently allow to use platform color: for example tintColor for ActionSheetIOS or interpolating colors for animations. For those use cases it would be nice to get the resolved color value for the current scheme (Appearance.getColorScheme()).

Example:

// platform-colors.config.js
module.exports = {
  "colors": {
    "background": {
      "light": "#ffffff",
      "dark": "#000000"
    },
    "accent": "pink"
  },
}

// somewhereelse.js
resolveColor("background")
resolveColor(Colors.background)

In this case resolveColor would query Appearance.getColorScheme() for the appropriate scheme and then return the actual color value.

Of course, this could already be done by importing the config and selecting from colors but it would be nice to have a importable function and type checked color names for this.

Unexpected token '.'

Screen Shot 2021-12-04 at 12 07 56 AM

same issue happens with the example app.

Screen Shot 2021-12-04 at 12 18 03 AM

Screen Shot 2021-12-04 at 12 18 24 AM

STR:

  • init a new react-native project
  • run npx @klarna/platform-colors in the root directory

[android] colors not reflecting runtime changes to system theme

Hello and thanks for the package!

based on the readme

Using platform colors enables you to change from light/dark mode instantly and without any additional rerenders.

I'm starting with an assumption that colors in the example app should update with the system theme change. However, on device / emulator I tested this on, it is not the case, as seen in the video below (Honor 20 pro, android 10 / Pixel_2_Android_11(AVD)).

SVID_20211219_142614_1.mp4

Is this a bug? I know that this may not be the package where the bug is happening (it probably is in the RN core?) but I wanted to ask anyway. Note that the useColorScheme() hook from rn core does pick up the change (also seen in the video). I have tested this also with RN 67-rc6 with the same result.

The same issue applies to icons not "refreshing" in https://github.com/klarna-incubator/react-native-vector-drawable

The bug goes away if I remove uiMode from

android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
but that is a workaround - the application is then torn down and recreated with the theme change and we don't want that.

The colors are rendered properly when the app is killed and started again.

Thanks for your thoughts! :)

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.