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

Switch from dark color to labelColor to fix darkmode issues. #3766

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jean-Daniel
Copy link

Issue Link 🔗

#3742

Goals ⚽

This change does not fix all Dark mode issues, but is (hopefully) a step in the right direction.

@codecov-io
Copy link

codecov-io commented Dec 3, 2018

Codecov Report

Merging #3766 into master will not change coverage.
The diff coverage is 50%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3766   +/-   ##
=======================================
  Coverage   32.67%   32.67%           
=======================================
  Files         114      114           
  Lines       10754    10754           
=======================================
  Hits         3514     3514           
  Misses       7240     7240
Impacted Files Coverage Δ
Source/Charts/Charts/ChartViewBase.swift 23.17% <ø> (ø) ⬆️
Source/Charts/Utils/Platform.swift 0% <ø> (ø) ⬆️
Source/Charts/Components/ChartLimitLine.swift 0% <ø> (ø) ⬆️
Source/Charts/Components/Description.swift 100% <ø> (ø) ⬆️
Source/Charts/Components/Legend.swift 64.45% <ø> (ø) ⬆️
Source/Charts/Components/AxisBase.swift 60.93% <ø> (ø) ⬆️
...Charts/Data/Implementations/ChartBaseDataSet.swift 14.4% <50%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f2c130...2a8a01f. Read the comment docs.

@thierryH91200
Copy link
Contributor

thierryH91200 commented Dec 8, 2018

it's not exactly correct

I did not look at the problem for ios
it can also be done at the program level

extension NSColor
{
    static var labelColor : NSColor
    {
        var labelColor : NSColor
        {
            return NSColor.black
        }
        if #available(OSXApplicationExtension 10.13, *) {
            return NSColor(named: "Color") ?? NSColor.black
        } else {
            return NSColor.black
        }

    }
}

and also create "Assets.xcassets"

capture d ecran 2018-12-08 14 31 00

capture d ecran 2018-12-08 14 31 20

capture d ecran 2018-12-08 14 31 28

@thierryH91200
Copy link
Contributor

in fact the problem is the assignment of the kind

@objc open var gridBackgroundColor = NSUIColor(red: 240/255.0, green: 240/255.0, blue: 240/255.0, alpha: 1.0)

rather
@objc open var gridBackgroundColor = NSUIColor.gridColor
see
open class var placeholderTextColor: NSColor { get }

AppKit
open class var windowFrameTextColor: NSColor { get }
open class var selectedMenuItemTextColor: NSColor { get }
open class var alternateSelectedControlTextColor: NSColor { get }
open class var headerTextColor: NSColor { get }

etc .....

UIKit is poor for the Color

@liuxuan30
Copy link
Member

@Jean-Daniel feedback to @thierryH91200?

@Jean-Daniel
Copy link
Author

If you want to use custom color and an asset catalog, you should use NSImage(named:bundle:), and place the asset catalog in the framework.

@jjatie
Copy link
Collaborator

jjatie commented Mar 9, 2019

@thierryH91200 I'm not sure what your issue with this PR is. macOS does provide a default label color for standard and dark modes and we should use it. For UIKit, this happens to be black, but it's reasonable to expect the API to exist in UIKit in the near future as well.

@Jean-Daniel please resolve conflicts

{
static var labelColor : UIColor
{
return UIColor.black

Choose a reason for hiding this comment

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

I get that this is an old PR, but if UIColor.label is returned here, we can get Dark Mode support for labels on iOS as well, which would be nice.

Copy link
Collaborator

@jjatie jjatie Sep 18, 2019

Choose a reason for hiding this comment

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

Simply removing the declaration will solve the issue for iOS 13+.

extension UIColor {
    @available(iOS, introduced: 9.0, obsoleted: 13.0)
    @available(tvOS, introduced: 9.0, obsoleted: 13.0)
    static var label: UIColor { .black }
}

and doing the same for NSColor

extension NSColor {
    @available(macOS, introduced: 10.11, obsoleted: 10.14)
    static var label: UIColor { .black }
}

@liuxuan30
Copy link
Member

I'm going to look at the dark mode stuff recently. I know this is an old pr and there is a new one:#3742, which seems doing the same thing.

from my comment #4171 (comment), we need to talk about a few things before. Can anyone reply? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants