Is there a shadow which looks cool on both light and dark? [closed]

I have implemented shadows in my app for light theme and they look really cool. I also have disabled them when in dark theme, since it is known that shadows on dark creat a kind of glow, which in fact is horrible.

The problem arises when I have to use shadows over user-generated content, which can be both light or dark (think like texts on blurred content). A solution would be to disable the shadows when the content is dark, but computing luminance is too expensive (since there could also be videos). Since I have the possibility, I tried instead of shadows the Material elevation, it doesn't create glows over dark but I generally don't like it and it is visually too heavy over the rest of theme of the app. So my question is: is there some features of shadow or a specific shadow which looks good both over light and dark? (Note that I can modify any aspect of the shadow, ex. color, opacity, blur...)