question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Margin or padding inside Color doesn't use background color

See original GitHub issue

A simple example:

<Color bgCyan black>
  <Box padding={1}>Text here</Box>
</Color>

Expected result: Text here at the center of a cyan box with 1 padding all around

Actual result: Text here with cyan background, but at the center of a 1 padding black box

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
vadimdemedescommented, May 23, 2020

So the issue is when you have a box with padding, like <Box padding={1}>Text</Box>, for <Color> component there’s nothing to color on first and third lines, because those are just empty.

I’m going to leave this issue open for now, but I think when Ink is going to have support for borders, this will get solved as part of that work.

1reaction
icoppcommented, Mar 27, 2019

That makes sense, but also makes me think that there’s missing functionality there on Box. Of course, that’s probably more suited to wait until after borders go on so any color stuff can take advantage of the same boundary handling.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why doesn't margin get filled with background color in CSS?
Margin is providing space beyond the element's box and therefore won't be colored - it's simply space. Padding on the other hand provides...
Read more >
How to change the margin color on CSS - Quora
Background color only apply to all width of that box model, so the total width of a box model = border left +...
Read more >
CSS Padding vs Margin - GeeksforGeeks
Margin is completely transparent, and it does not have any background color. It clears the area around the element.
Read more >
CSS margin vs. padding - LogRocket Blog
Differences between margin and padding · Spacing · Padding takes the background color; Margin doesn't · margin can be set to auto; padding...
Read more >
Css/Training/padding and margin - W3C Wiki
Margin doesn't have a background color. [Syntax] margin-top: <length> | <percentage> margin-right: <length> | <percentage> margin- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found