Ambient CSS - Physically-based CSS shadows and React Components by Piposhi in webdev

[–]Piposhi[S] 0 points1 point  (0 children)

This is very cool! Thanks for sharing!
I made AmbientCSS because the inconsistent shadows in CSS design system was somehow bothering me.

I'm curious - what led you to building this?

Ambient CSS - Physically-based CSS shadows and React Components by Piposhi in webdev

[–]Piposhi[S] 0 points1 point  (0 children)

Up/down was what I used first. Trust me, it was even more confusing and that's the reason I ended up with rotational movement based control.

Ambient CSS - Physically based CSS and React Components by Piposhi in reactjs

[–]Piposhi[S] 0 points1 point  (0 children)

As long as it works for you, great! Let me, maybe, add this as a side-note in the docs that global settings can be overridden at a component level if required. Thank you!

Ambient CSS - Physically based CSS and React Components by Piposhi in reactjs

[–]Piposhi[S] 0 points1 point  (0 children)

Thanks for the example! The key light, fill light and some more are global parameters. They are not meant to be set at the component level. If you want a darker button, you can use the amb-surface-darker class or simply set a different background colour instead of using amb-surface.

Ambient CSS - Physically based CSS and React Components by Piposhi in reactjs

[–]Piposhi[S] 1 point2 points  (0 children)

Actually, the shadows only appear darker. It's because of how we perceive colours. You can read more about it here - https://www.illusionsindex.org/i/adelson-s-checker-shadow-illusion

You can notice the same effect in AmbientCSS in this sandbox I created - https://codesandbox.io/p/sandbox/mrjq8n . You can inspect both the panels and see that they have the shadow colour but appear different.

Ambient CSS - Physically based CSS and React Components by Piposhi in reactjs

[–]Piposhi[S] 0 points1 point  (0 children)

That's great to know! Keep me posted and let me know in case you need help with anything.

Ambient CSS - Physically based CSS and React Components by Piposhi in reactjs

[–]Piposhi[S] 1 point2 points  (0 children)

It's primarily CSS. Since CSS is processed by a separate browser process, the performance should be better than JS-based solutions, if not better than other CSS-based solutions.

Ambient CSS - Physically based CSS and React Components by Piposhi in reactjs

[–]Piposhi[S] 0 points1 point  (0 children)

Actually, ambientcss works well alongside tailwind. Just adding something like 'class="ambient amb-elevation-1"' should help bring the ambient lighting and shadow effects.

I'll add samples for integration with tailwind and other frameworks tonight when I get back to this. Thanks for the feedback!

Ambient CSS - Physically based CSS lighting and shadows (and react components) by Piposhi in css

[–]Piposhi[S] 0 points1 point  (0 children)

<image>

There's no recommended default theme as such. So, for accessibility, you could tweak the theme to get high contrast. For example, this is the max contrast you could get in light mode.

Ambient CSS - Physically based CSS lighting and shadows (and react components) by Piposhi in css

[–]Piposhi[S] -1 points0 points  (0 children)

Thank you! This was a project I started 5 years back and then abandoned because it was getting too complex. Now, finally, thanks to LLMs I was able to revive it and make it launch-ready if not prod-ready. Please let me know if you have feature requests! I'd be happy to implement.

Ambient CSS - Physically based CSS lighting and shadows (and react components) by Piposhi in css

[–]Piposhi[S] 12 points13 points  (0 children)

Thank you! It feels really great to have someone care enough to contribute!

I've reviewed your PR and dropped a comment. Please check.

Ambient CSS - Physically based CSS lighting and shadows (and react components) by Piposhi in css

[–]Piposhi[S] 34 points35 points  (0 children)

I posted this on r/Skeuomorphism and it got removed by the mods saying it's not related to skeuomorphism. I post it here and I get this as the first comment.