Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add borderBackgroundColor option #100

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Caesarovich
Copy link
Collaborator

Hi,

I've added the borderBackgroundColor option, following most of @ThornDuke's implementation in #94. I've also added docs, example, test and types.

All tests pass except the xo that throws this error for pre-existing code:

  index.d.ts:9:5
  ✖   9:5   any overrides all other types in this intersection type.  @typescript-eslint/no-redundant-type-constituents
  ✖  42:5   any overrides all other types in this intersection type.  @typescript-eslint/no-redundant-type-constituents
  ✖  85:39  any overrides all other types in this union type.         @typescript-eslint/no-redundant-type-constituents

I'm not quite sure what triggers it, it might be a new error due to the recent dependency bump (see #97).

Also I'm wondering if we should make borderBackgroundColor default to backgroundColor if unspecified ?

closes #94

index.d.ts Outdated Show resolved Hide resolved
@Caesarovich Caesarovich requested a review from sindresorhus July 17, 2024 07:44
@sindresorhus
Copy link
Owner

Also I'm wondering if we should make borderBackgroundColor default to backgroundColor if unspecified ?

👍

@Caesarovich
Copy link
Collaborator Author

I've made it so that the user can specify 'none' for no color. I'm unsure if it's good or if we should use null instead.


Defaults to `backgroundColor`. Use `'none'` for no color.
*/
readonly borderBackgroundColor?: Color;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
readonly borderBackgroundColor?: Color;
readonly borderBackgroundColor?: Color | undefined;

This would be better than 'none'.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wouldn't work because now there is no way to differentiate between "unspecified" and "explicitly no color". Maybe should we revert this back ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it should not be in the general Color type. Only this property needs it. And what do you think of instead having a 'inherit' case, which it would default to?

So:

  • {borderBackgroundColor: undefined} => no color
  • {borderBackgroundColor: 'inherit'} => inherit color
  • {} => inherit color

@Caesarovich Caesarovich requested a review from sindresorhus July 20, 2024 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Add the option borderBackgroundColor
2 participants