wails icon indicating copy to clipboard operation
wails copied to clipboard

[V3] Add `getAccentColor` method

Open Etesam913 opened this issue 7 months ago • 3 comments

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes #4329

Type of change

Please select the option that is relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • [ ] Windows
  • [x] macOS
  • [ ] Linux

If you checked Linux, please specify the distro and version.

Test Configuration

Please paste the output of wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.

etesam@etesams-MacBook-Air ~/C/w/wails (getAccentColor)> wails3 doctor
 Wails (v3.0.0-dev)  Wails Doctor 
                                                                                                                                    
# System 

┌──────────────────────────────────────────────────┐
| Name          | MacOS                            |
| Version       | 15.5                             |
| ID            | 24F74                            |
| Branding      | Sequoia                          |
| Platform      | darwin                           |
| Architecture  | arm64                            |
| Apple Silicon | true                             |
| CPU           | Apple M2                         |
| CPU 1         | Apple M2                         |
| CPU 2         | Apple M2                         |
| GPU           | 10 cores, Metal Support: Metal 3 |
| Memory        | 24 GB                            |
└──────────────────────────────────────────────────┘

# Build Environment 

┌─────────────────────────────────────────────────────────┐
| Wails CLI    | v3.0.0-dev                               |
| Go Version   | go1.24.3                                 |
| Revision     | 83005be066de63f70141cdc7443f7885c34bb300 |
| Modified     | false                                    |
| -buildmode   | exe                                      |
| -compiler    | gc                                       |
| CGO_CFLAGS   |                                          |
| CGO_CPPFLAGS |                                          |
| CGO_CXXFLAGS |                                          |
| CGO_ENABLED  | 1                                        |
| CGO_LDFLAGS  |                                          |
| GOARCH       | arm64                                    |
| GOARM64      | v8.0                                     |
| GOOS         | darwin                                   |
| vcs          | git                                      |
| vcs.modified | false                                    |
| vcs.revision | 83005be066de63f70141cdc7443f7885c34bb300 |
| vcs.time     | 2025-05-26T11:03:37Z                     |
└─────────────────────────────────────────────────────────┘

# Dependencies 

┌────────────────────────────────────────────────────────────────────────┐
| Xcode cli tools | 2409                                                 |
| npm             | 10.9.2                                               |
| *NSIS           | Not Installed. Install with `brew install makensis`. |
|                                                                        |
└─────────────────────── * - Optional Dependency ────────────────────────┘

# Checking for issues 

 SUCCESS  No issues found

# Diagnosis 

 SUCCESS  Your system is ready for Wails development!

Need documentation? Run: wails3 docs
 ♥   If Wails is useful to you or your company, please consider sponsoring the project: wails3 sponsor

Checklist:

  • [x] I have updated website/src/pages/changelog.mdx with details of this PR
  • [x] My code follows the general coding style of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] My changes generate no new warnings
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • New Features
    • Introduced the ability to retrieve the system accent color on macOS. This feature provides the accent color as an RGB string for supported systems.

Etesam913 avatar May 31 '25 17:05 Etesam913

[!IMPORTANT]

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

104 files out of 211 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

"""

Walkthrough

A new feature was introduced to retrieve the system accent color on macOS. This includes adding a GetAccentColor() method to the application API, platform-specific implementation for macOS using Objective-C, and documentation of the change in the changelog. No other logic or control flow was modified.

Changes

File(s) Change Summary
docs/src/content/docs/changelog.mdx Added changelog entry for new app.GetAccentColor() feature in v3.0.0-alpha.9.
v3/pkg/application/application.go Added GetAccentColor() to App struct; updated interface; default/fallback value logic added.
v3/pkg/application/application_darwin.go Implemented macOS-specific accent color retrieval in C/Objective-C; added getAccentColor() method.
v3/pkg/application/application_linux.go, application_windows.go Added getAccentColor() methods returning default color strings for Linux and Windows platforms.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant platformApp (macosApp)
    participant macOS System

    App->>platformApp (macosApp): GetAccentColor()
    alt platformApp is nil
        App->>App: return "rgb(0,122,255)"
    else platformApp is macosApp
        platformApp (macosApp)->>macOS System: getAccentColor()
        macOS System-->>platformApp (macosApp): "rgb(r,g,b)"
        platformApp (macosApp)-->>App: "rgb(r,g,b)"
    end

Assessment against linked issues

Objective Addressed Explanation
Add a getAccentColor method to retrieve the macOS system accent color (#4329)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Poem

A hop and a skip, a color so bright,
Now apps can match your Mac just right!
With GetAccentColor() in the code,
The user's style is now bestowed.
Rabbits cheer, the theme's in sync—
Blue, green, or pink, what do you think?
🐇🌈 """

✨ Finishing Touches
  • [ ] 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar May 31 '25 17:05 coderabbitai[bot]

I'm not sure where any tests for this feature would be added in the project?

Etesam913 avatar May 31 '25 17:05 Etesam913

Thanks for opening this. Do you think it might be better to use something like app.Mac.GetAccentColour? Also https://github.com/wailsapp/wails/actions/runs/15365920957/job/43238816949?pr=4330 shows that as there is no implementation (even a nop one) on Linux, the build fails. Same will be true for Windows.

leaanthony avatar Jun 01 '25 06:06 leaanthony

@Etesam913 thoughts?

leaanthony avatar Jun 12 '25 11:06 leaanthony

Quality Gate Failed Quality Gate failed

Failed conditions
16 Security Hotspots
3.1% Duplication on New Code (required ≤ 3%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

sonarqubecloud[bot] avatar Jul 06 '25 19:07 sonarqubecloud[bot]