Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Remove SystemColors from .NET Core #17669

Closed
wants to merge 3 commits into from
Closed

Remove SystemColors from .NET Core #17669

wants to merge 3 commits into from

Conversation

qmfrederik
Copy link

As SystemColors is not in .NET Standard, it doesn't make much sense to have it in .NET Core, either.

Fixes #17024

@danmoseley
Copy link
Member

I guess from CompnentModel we should just remove this line
HashSet<Color> set = new HashSet<Color>(ColorTable.Colors.Values.Concat(ColorTable.SystemColors.Values));

@danmoseley
Copy link
Member

System.Drawing.ColorTable will also need some neutering.

@mellinoe
Copy link
Contributor

Plenty of things are in .NET Core but not in .NET Standard. Is that the primary motivation here?

@danmoseley
Copy link
Member

@mellinoe see discussion in #17024

dict.Add("ScrollBar", Color.FromArgb(unchecked((int)0xffd4d0c8)));
dict.Add("Window", Color.FromArgb(unchecked((int)0xffffffff)));
dict.Add("WindowFrame", Color.FromArgb(unchecked((int)0xff000000)));
dict.Add("WindowText", Color.FromArgb(unchecked((int)0xff000000)));
Copy link
Member

@stephentoub stephentoub Mar 30, 2017

Choose a reason for hiding this comment

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

Since we need this list anyway in order to populate the dictionary, did you consider just making SystemColors internal instead of public?

Copy link
Author

Choose a reason for hiding this comment

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

@stephentoub Yeah, I was just thinking about that. I've updated the PR, this will probably be a more elegant fix. Thanks!

else if (c.IsSystemColor)
{
member = typeof(SystemColors).GetProperty(c.Name);
}
Copy link
Member

Choose a reason for hiding this comment

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

That we're able to delete this without changing any tests suggests we don't have any tests covering this functionality?

Copy link
Author

Choose a reason for hiding this comment

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

It seems so, indeed. I'm also guessing there are no unit tests for the IsSystemColor property, either.

@qmfrederik
Copy link
Author

@stephentoub I updated the PR after you approved it, can you have another look just to be sure? I had to move SystemColors.cs to the Common folder (not sure why Git didn't see it as a move) as it ends up being used by both System.ComponentModel and System.Drawing.Primimitives.

Other than that, I think this PR is pretty much ready.

@stephentoub
Copy link
Member

Why does System.ComponentModel need it? Is that dead code now that could be removed, or is it functionality that would highlight a need for keeping SystemColors, or something else? I also think it's strange that we're getting rid of SystemColors when we have the public Color.IsSystemColor property.

@qmfrederik
Copy link
Author

qmfrederik commented Mar 30, 2017

The reason ComponentModel needs it is because it takes a dependency on KnownColors and the "system colors" are still available on KnownColors.

Net:

  1. The system colors persist in the KnownColors enumaration
  2. The notion of system colors persists in Color.IsSystemColor

which is a bit strange indeed. Let's discuss that on dotnet/standard#240

@alexperovich
Copy link
Member

I don't like moving the SystemColors enum into Common. We should completely remove the SystemColors enum, the members in KnownColor that are SystemColors, the IsSystemColor property on Color, and any usages of SystemColors in TypeConverter.

@danmoseley
Copy link
Member

Hold on this until questions in dotnet/standard#240 are resolved. I'm pretty confused at this point. @weshaggard

@weshaggard
Copy link
Member

I think we should remove the SystemColors type and its usages in the ColorTable from the implementation completely.

@weshaggard
Copy link
Member

@qmfrederik could you please update this PR to match the new surface area for .NET Standard in PR dotnet/standard#290. Before I finalize that surface area into the standard I want to make sure the implementation still make sense or if there are any other issues that arise in the implementation. Things like does the color converter still work or Color.FromName is still useful etc.

@qmfrederik
Copy link
Author

@weshaggard I'll do the update but it may take a couple of days before I can get to it. Apologies for the delay.

@weshaggard
Copy link
Member

@qmfrederik OK I might go ahead and submit a PR to update corefx tomorrow as I would like to get the standard edits finalized this week.

@weshaggard
Copy link
Member

Thanks for the contribution @qmfrederik but I'm closing this PR in favor of #18010.

@weshaggard weshaggard closed this Apr 6, 2017
@karelz karelz modified the milestone: 2.0.0 Apr 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants