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 support to SF Symbols for Variable Colors (variableValue) #405

Open
karillo opened this issue Jan 10, 2024 · 0 comments
Open

Add support to SF Symbols for Variable Colors (variableValue) #405

karillo opened this issue Jan 10, 2024 · 0 comments

Comments

@karillo
Copy link

karillo commented Jan 10, 2024

Describe the bug
In addition to SF Symbols support for renderingMode, weight and scale, it would be useful to be able to specify the variableValue for Symbols with variable color support.

Ref: https://developer.apple.com/documentation/uikit/uiimage/3955178-init

To Reproduce
Feature request

Expected behavior
I was hoping that perhaps this came along with the work for sfconfig.

Possible something along the lines of an sfconfig string of:

{"variableValue":0.25}

or a new parameter like

| sfvalue=0.25

Environment:

  • macOS version: 14.2.1
  • SwiftBar version: 2.0.0

Plugin Example:
The :wifi: symbol supports variable color (variableValue). I was imagining something like this:

#!/bin/bash

WIFIDATA=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I)
SSID=$(echo "${WIFIDATA}" | awk '/ SSID/ {print substr($0, index($0, $2))}')
SIGNAL=$(echo "${WIFIDATA}" | awk '/ agrCtlRSSI/ {print substr($0, index($0, $2))}')
NOISE=$(echo "${WIFIDATA}" | awk '/ agrCtlNoise/ {print substr($0, index($0, $2))}')

SNR="$((SIGNAL - NOISE))"

QUALITY="$((2 * SNR))"
QUALITY="$((QUALITY < 100 ? QUALITY : 100))"
SFCONFIG='{"variableValue":'$(bc -e "scale=2;${QUALITY}/100")'}'

cat <<EOF
${QUALITY}% | sfimage=wifi sfconfig=$(echo -n "${SFCONFIG}" | base64)
---
$SSID
---
Refresh... | refresh=true
EOF
@karillo karillo changed the title Add support to SF Symbols for Variable Colors (VariableValue) Add support to SF Symbols for Variable Colors (variableValue) Jan 10, 2024
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

No branches or pull requests

1 participant