You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the format boundary design is an added, or in some cases an updated, background colour. This doesn't really work well with all formats.
The link format is an exception, it changes the colour to blue.
The code format is an exception, it changes the colour to a different gray.
Custom format would need to include their own styles as it may not work for them. E.g. a colour background button cannot have a background as a boundary style.
It doesn't work great on different backgrounds, such as the cover image.
Ideally, we would need something that:
Works well with all themes, so that themes do not need to update format boundaries.
Works well with all formats and potential custom formats.
Works well on all backgrounds.
I would suggest using:
currentColor as it inherits the text colour, so the contrast will automatically work.
Something that is additional foreground, not background. This is more difficult as it should not interfere with anything the format does. So no underline, as that interferes with links. It should also spread over the whole length. Perhaps an overline? This might not look so good.
None honestly seem better than the background idea — and using mix-blend-mode we could theoretically ensure it should always work in any color sets. I also don't hagte your idea. Just wondering if it's obvious enough what's going on.
The best thing I found so far is having ~20% currentColor and ~80% transparent as a background. The only problem is that there's no way other than using a pseudo element for it, which doesn't work well with inline elements. I tried background: rbga( currentColor, 0.2 ), but that doesn't work. :(
Yep, I had the exact same idea and even tried it. Didn't work.
You can even use a magic CSS variable to use the color from the operating system selection color. But we tried that and it wasn't solid enough either :(
@jasmussen I tried everything there is in CSS but couldn't get it to work in any way. Luckily we still have JavaScript. :) So now I made something that calculates the current color + opacity and puts the rule in an inline style element. Not perfect, but it works really well. There are some small downsides like hovering style won't change the background, but I think this may be ok. Even that I think I may be able to do.
Not sure if the amount of opacity is perfect, but we could tune it. When it is white, it seems like it could be more white, but when it is gray, I'm not sure if we can go darker.
The good thing about this is that no block will ever need to think about boundary styles. What do you think?
Wow, that latest exploration looks great, @iseulde! 👏
I think the opacity could be tuned down very slightly, but otherwise that seems excellent. I totally agree with @jasmussen above — I don't see any reason not to use JS here, and I think the hovering issue is fine too. 👍
@kjellr Less opacity? That would mean the background behind bold would be darker, which looks like a bit too much for me. It's hard to find a good balance.
@kjellr even in that case, the background for e.g. white text would feel a bit too light to me. Happy to try to figure out to set different opacities for different circumstances though. Not sure what I’d have to base it on. :)
Now that I'm looking at the screenshots again, I agree that'd be a problem in that case. Using different opacities for different backgrounds would be cool, but even if that doesn't work out I think this is a really solid solution. 👍
Activity
ellatrix commentedon Feb 21, 2019
Maybe this could work?
^ double format
ellatrix commentedon Feb 21, 2019
Personally I like the background, it just doesn't work in all cases. :(
jasmussen commentedon Feb 22, 2019
Thanks for making this ticket and explaining it so thoroughly. Just to be sure, this is a design consideration, not a technical one, correct?
I put together a codepen with two ideas: https://codepen.io/joen/pen/ZwdBgN?editors=1100
None honestly seem better than the background idea — and using mix-blend-mode we could theoretically ensure it should always work in any color sets. I also don't hagte your idea. Just wondering if it's obvious enough what's going on.
ellatrix commentedon Feb 22, 2019
The best thing I found so far is having ~20%
currentColorand ~80% transparent as a background. The only problem is that there's no way other than using a pseudo element for it, which doesn't work well with inline elements. I triedbackground: rbga( currentColor, 0.2 ), but that doesn't work. :(jasmussen commentedon Feb 22, 2019
Yep, I had the exact same idea and even tried it. Didn't work.
You can even use a magic CSS variable to use the color from the operating system selection color. But we tried that and it wasn't solid enough either :(
ellatrix commentedon Feb 22, 2019
@jasmussen I tried everything there is in CSS but couldn't get it to work in any way. Luckily we still have JavaScript. :) So now I made something that calculates the current color + opacity and puts the rule in an inline style element. Not perfect, but it works really well. There are some small downsides like hovering style won't change the background, but I think this may be ok. Even that I think I may be able to do.
Not sure if the amount of opacity is perfect, but we could tune it. When it is white, it seems like it could be more white, but when it is gray, I'm not sure if we can go darker.
The good thing about this is that no block will ever need to think about boundary styles. What do you think?
jasmussen commentedon Feb 22, 2019
Wow that is ... holy wow that's kind of incredible work. :slow clap for a long time:
I don't know why I didn't consider JS here — but this is a JS editor, it won't work at all without JS so it seems totally fine to do this.
I think that's totally okay, and can be revisited if we feel we need it.
kjellr commentedon Feb 22, 2019
Wow, that latest exploration looks great, @iseulde! 👏
I think the opacity could be tuned down very slightly, but otherwise that seems excellent. I totally agree with @jasmussen above — I don't see any reason not to use JS here, and I think the hovering issue is fine too. 👍
ellatrix commentedon Feb 22, 2019
@kjellr Less opacity? That would mean the background behind bold would be darker, which looks like a bit too much for me. It's hard to find a good balance.
kjellr commentedon Feb 22, 2019
Sorry for the confusion — I mean that the background could be a little bit lighter, not darker. But yeah, striking a balance is tough. 🙂
ellatrix commentedon Feb 22, 2019
@kjellr even in that case, the background for e.g. white text would feel a bit too light to me. Happy to try to figure out to set different opacities for different circumstances though. Not sure what I’d have to base it on. :)
kjellr commentedon Feb 22, 2019
Now that I'm looking at the screenshots again, I agree that'd be a problem in that case. Using different opacities for different backgrounds would be cool, but even if that doesn't work out I think this is a really solid solution. 👍