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

Custom color format #135

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Mintfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
realm/SwiftLint@0.42.0
nicklockwood/SwiftFormat@0.47.10
realm/SwiftLint@0.52.4
nicklockwood/SwiftFormat@0.55.1
22 changes: 18 additions & 4 deletions Pika.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
EAF100C725C731AD006E1EC3 /* SplashTouchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF100C625C731AD006E1EC3 /* SplashTouchBar.swift */; };
EAF100CA25C75218006E1EC3 /* PikaTouchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF100C325C59EB3006E1EC3 /* PikaTouchBar.swift */; };
EAF100CD25C785C4006E1EC3 /* TouchBarVisual.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF100CC25C785C4006E1EC3 /* TouchBarVisual.swift */; };
F1B4CCC22CDED4AC00DF1593 /* FormatExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1B4CCC12CDED4A100DF1593 /* FormatExampleView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -82,6 +83,10 @@
23EE8C0928DA24AE0042090A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
23EE8C0A28DA3FF00042090A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = "<group>"; };
92D97C2125FF7A5A007CCDE4 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
C1BF641E2C1AE533004D33DD /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
C1BF641F2C1AE533004D33DD /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
C1BF64202C1AE53C004D33DD /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
C1BF64212C1AE53C004D33DD /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Main.strings"; sourceTree = "<group>"; };
EA0C524F25AA729300AFF716 /* Visualisation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Visualisation.swift; sourceTree = "<group>"; };
EA0C525F25AB5A2B00AFF716 /* NavigationMenuItems.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationMenuItems.swift; sourceTree = "<group>"; };
EA0C526325AB5D1700AFF716 /* PikaWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PikaWindow.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -134,6 +139,7 @@
EAF100C325C59EB3006E1EC3 /* PikaTouchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PikaTouchBar.swift; sourceTree = "<group>"; };
EAF100C625C731AD006E1EC3 /* SplashTouchBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SplashTouchBar.swift; sourceTree = "<group>"; };
EAF100CC25C785C4006E1EC3 /* TouchBarVisual.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchBarVisual.swift; sourceTree = "<group>"; };
F1B4CCC12CDED4A100DF1593 /* FormatExampleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormatExampleView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -264,6 +270,7 @@
EAD0B6F2259CF29300FA2F67 /* Views */ = {
isa = PBXGroup;
children = (
F1B4CCC12CDED4A100DF1593 /* FormatExampleView.swift */,
EAD0B6F3259CF29300FA2F67 /* AboutView.swift */,
220D5E9328DB154300B6285E /* AppModeButtons.swift */,
220D5E9728DB158400B6285E /* AppModeToggleGroup.swift */,
Expand Down Expand Up @@ -357,6 +364,8 @@
fr,
de,
es,
"zh-Hans",
"zh-Hant",
);
mainGroup = EAD0B6BF259CED1C00FA2F67;
packageReferences = (
Expand Down Expand Up @@ -445,6 +454,7 @@
22D28DB72862377F00FC7DD4 /* OverflowContentViewModifier.swift in Sources */,
EAA8AE1C25B8F03B0049299B /* KeyboardShortcutGrid.swift in Sources */,
220D5E9828DB158400B6285E /* AppModeToggleGroup.swift in Sources */,
F1B4CCC22CDED4AC00DF1593 /* FormatExampleView.swift in Sources */,
EA0C525025AA729300AFF716 /* Visualisation.swift in Sources */,
EAD0B6FB259CF29300FA2F67 /* ContentView.swift in Sources */,
EAD0B6CC259CED1C00FA2F67 /* AppDelegate.swift in Sources */,
Expand Down Expand Up @@ -496,6 +506,8 @@
92D97C2125FF7A5A007CCDE4 /* fr */,
23EE8C0928DA24AE0042090A /* de */,
223FDEEF2B038A9B000F89A0 /* es */,
C1BF641E2C1AE533004D33DD /* zh-Hans */,
C1BF64202C1AE53C004D33DD /* zh-Hant */,
);
name = Localizable.strings;
sourceTree = "<group>";
Expand All @@ -508,6 +520,8 @@
EA0F36AE2929138E00BFC7EB /* en */,
EA0F36B02929139000BFC7EB /* fr */,
223FDEEE2B038A9B000F89A0 /* es */,
C1BF641F2C1AE533004D33DD /* zh-Hans */,
C1BF64212C1AE53C004D33DD /* zh-Hant */,
);
name = Main.storyboard;
sourceTree = "<group>";
Expand Down Expand Up @@ -644,7 +658,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 39;
CURRENT_PROJECT_VERSION = 41;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Pika/Preview Content\"";
DEVELOPMENT_TEAM = TGHU37N6EX;
Expand All @@ -658,7 +672,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 0.0.17;
MARKETING_VERSION = "0.0.18-beta2";
PRODUCT_BUNDLE_IDENTIFIER = com.superhighfives.Pika;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -675,7 +689,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 39;
CURRENT_PROJECT_VERSION = 41;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Pika/Preview Content\"";
DEVELOPMENT_TEAM = TGHU37N6EX;
Expand All @@ -689,7 +703,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 0.0.17;
MARKETING_VERSION = "0.0.18-beta2";
PRODUCT_BUNDLE_IDENTIFIER = com.superhighfives.Pika;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
28 changes: 27 additions & 1 deletion Pika/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
}
}

if action == "system" {
if task == "foreground" {
NSApp.sendAction(#selector(AppDelegate.triggerSystemPickerForeground(_:)), to: nil, from: nil)
}

if task == "background" {
NSApp.sendAction(#selector(AppDelegate.triggerSystemPickerBackground(_:)), to: nil, from: nil)
}
}

if action == "copy", task == "foreground" {
NSApp.sendAction(#selector(AppDelegate.triggerCopyForeground(_:)), to: nil, from: nil)
}
Expand Down Expand Up @@ -329,7 +339,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
@IBAction func openSplashWindow(_: Any?) {
splashWindow = PikaWindow.createSecondaryWindow(
title: "Splash",
size: NSRect(x: 0, y: 0, width: 650, height: 260),
size: NSRect(x: 0, y: 0, width: 650, height: 380),
styleMask: [.titled, .fullSizeContentView]
)
if #available(OSX 11.0, *) {
Expand Down Expand Up @@ -358,6 +368,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
notificationCenter.post(name: Notification.Name(PikaConstants.ncTriggerCopyBackground), object: self)
}

@IBAction func triggerSystemPickerForeground(_: Any) {
notificationCenter.post(name: Notification.Name(PikaConstants.ncTriggerSystemPickerForeground), object: self)
}

@IBAction func triggerSystemPickerBackground(_: Any) {
notificationCenter.post(name: Notification.Name(PikaConstants.ncTriggerSystemPickerBackground), object: self)
}

@IBAction func triggerSwap(_: Any) {
notificationCenter.post(name: Notification.Name(PikaConstants.ncTriggerSwap), object: self)
}
Expand Down Expand Up @@ -394,6 +412,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
notificationCenter.post(name: Notification.Name(PikaConstants.ncTriggerFormatHSL), object: self)
}

@IBAction func triggerFormatOpenGL(_: Any) {
notificationCenter.post(name: Notification.Name(PikaConstants.ncTriggerFormatOpenGL), object: self)
}

@IBAction func triggerFormatCustom(_: Any) {
notificationCenter.post(name: Notification.Name(PikaConstants.ncTriggerFormatCustom), object: self)
}

@IBAction func hidePika(_: Any) {
hideMainWindow()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "paintpalette.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 19 additions & 3 deletions Pika/Assets/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23094"/>
</dependencies>
<scenes>
<!--Application-->
Expand Down Expand Up @@ -91,7 +91,7 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="qXi-VF-aR5"/>
<menuItem title="Copy all as textt" allowsKeyEquivalentWhenHidden="YES" id="D8e-06-QFY">
<menuItem title="Copy all as text" allowsKeyEquivalentWhenHidden="YES" id="D8e-06-QFY">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="triggerCopyBackground:" target="Voe-Tx-rLC" id="gum-gU-6N8"/>
Expand Down Expand Up @@ -127,6 +127,17 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="DMb-e0-vJg"/>
<menuItem title="Use system picker for foreground" keyEquivalent="s" allowsKeyEquivalentWhenHidden="YES" id="hMH-To-rZ9">
<connections>
<action selector="triggerSystemPickerForeground:" target="Ady-hI-5gd" id="PCg-9B-kjb"/>
</connections>
</menuItem>
<menuItem title="Use system picker for background" keyEquivalent="S" allowsKeyEquivalentWhenHidden="YES" id="CnG-MW-7x1">
<connections>
<action selector="triggerSystemPickerBackground:" target="Ady-hI-5gd" id="ND4-YV-SIu"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="dxL-CK-7Ia"/>
<menuItem title="Swap colors" keyEquivalent="x" allowsKeyEquivalentWhenHidden="YES" id="6j0-AT-P3M">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
Expand Down Expand Up @@ -158,6 +169,11 @@
<action selector="triggerFormatHSL:" target="Voe-Tx-rLC" id="u6q-Ow-iJq"/>
</connections>
</menuItem>
<menuItem title="OpenGL" keyEquivalent="5" allowsKeyEquivalentWhenHidden="YES" id="caq-wZ-Zn0" userLabel="Format">
<connections>
<action selector="triggerFormatHSL:" target="Voe-Tx-rLC" id="aIc-Ec-3GJ"/>
</connections>
</menuItem>
</items>
</menu>
<connections>
Expand Down
15 changes: 15 additions & 0 deletions Pika/Assets/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@
/* Copy RGB values */
"color.copy.rgb" = "RGB-Werte kopieren";

/* Copy OpenGL values */
"color.copy.opengl" = "OpenGL-Werte kopieren";

/* System color picker */
"color.system" = "Systemfarbwähler";

/* Use foreground system color picker */
"color.system.foreground" = "Vordergrund-Systemfarbauswahl";

/* Use background system color picker */
"color.system.background" = "Hintergrund-Systemfarbauswahl";

/* HEX format */
"color.format.hex" = "Hex-Format";

Expand All @@ -61,6 +73,9 @@
/* RGB format */
"color.format.rgb" = "RGB-Format";

/* OpenGL format */
"color.format.opengl" = "OpenGL-Format";

/* Copy all as text */
"color.copy.text" = "Als Text kopieren";

Expand Down
Binary file modified Pika/Assets/en.lproj/Localizable.strings
Binary file not shown.
Binary file modified Pika/Assets/es.lproj/Localizable.strings
Binary file not shown.
Binary file modified Pika/Assets/fr.lproj/Localizable.strings
Binary file not shown.
Binary file added Pika/Assets/zh-Hans.lproj/Localizable.strings
Binary file not shown.
93 changes: 93 additions & 0 deletions Pika/Assets/zh-Hans.lproj/Main.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

/* Class = "NSMenuItem"; title = "Pika"; ObjectID = "1Xt-HY-uBw"; */
"1Xt-HY-uBw.title" = "Pika";

/* Class = "NSMenuItem"; title = "Quit Pika"; ObjectID = "4sb-4s-VLi"; */
"4sb-4s-VLi.title" = "退出 Pika";

/* Class = "NSMenuItem"; title = "Edit"; ObjectID = "5QF-Oa-p0T"; */
"5QF-Oa-p0T.title" = "编辑";

/* Class = "NSMenuItem"; title = "About Pika"; ObjectID = "5kV-Vb-QxS"; */
"5kV-Vb-QxS.title" = "关于 Pika";

/* Class = "NSMenuItem"; title = "Redo"; ObjectID = "6dh-zS-Vam"; */
"6dh-zS-Vam.title" = "重做";

/* Class = "NSMenuItem"; title = "Swap colors"; ObjectID = "6j0-AT-P3M"; */
"6j0-AT-P3M.title" = "交换颜色";

/* Class = "NSMenu"; title = "Main Menu"; ObjectID = "AYu-sK-qS6"; */
"AYu-sK-qS6.title" = "主菜单";

/* Class = "NSMenuItem"; title = "Check for updates…"; ObjectID = "BOF-NM-1cW"; */
"BOF-NM-1cW.title" = "检查更新…";

/* Class = "NSMenuItem"; title = "Copy all as text"; ObjectID = "D8e-06-QFY"; */
"D8e-06-QFY.title" = "复制全部为文本";

/* Class = "NSMenu"; title = "Help"; ObjectID = "F2S-fz-NVQ"; */
"F2S-fz-NVQ.title" = "帮助";

/* Class = "NSMenuItem"; title = "Pika website"; ObjectID = "FKE-Sm-Kum"; */
"FKE-Sm-Kum.title" = "Pika 网站";

/* Class = "NSMenu"; title = "Eyedroppers"; ObjectID = "KHB-9b-hO2"; */
"KHB-9b-hO2.title" = "吸管工具";

/* Class = "NSMenuItem"; title = "Show All"; ObjectID = "Kd2-mp-pUS"; */
"Kd2-mp-pUS.title" = "显示全部";

/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */
"NMo-om-nkz.title" = "服务";

/* Class = "NSMenuItem"; title = "Preferences…"; ObjectID = "NQA-cg-qc7"; */
"NQA-cg-qc7.title" = "首选项…";

/* Class = "NSMenuItem"; title = "Pick foreground..."; ObjectID = "Nec-cr-B3a"; */
"Nec-cr-B3a.title" = "选择前景色...";

/* Class = "NSMenuItem"; title = "Hide Pika"; ObjectID = "Olw-nP-bQN"; */
"Olw-nP-bQN.title" = "隐藏 Pika";

/* Class = "NSMenuItem"; title = "Copy all as JSON"; ObjectID = "U40-Ip-3Uj"; */
"U40-Ip-3Uj.title" = "复制全部为 JSON";

/* Class = "NSMenuItem"; title = "Close window"; ObjectID = "VpE-fH-2gc"; */
"VpE-fH-2gc.title" = "关闭窗口";

/* Class = "NSMenuItem"; title = "Hide Others"; ObjectID = "Vdr-fp-XzO"; */
"Vdr-fp-XzO.title" = "隐藏其他";

/* Class = "NSMenu"; title = "Edit"; ObjectID = "W48-6f-4Dl"; */
"W48-6f-4Dl.title" = "编辑";

/* Class = "NSMenuItem"; title = "Pick background..."; ObjectID = "YF5-6a-ACB"; */
"YF5-6a-ACB.title" = "选择背景色...";

/* Class = "NSMenuItem"; title = "Eyedroppers"; ObjectID = "dNS-BC-3MB"; */
"dNS-BC-3MB.title" = "吸管工具";

/* Class = "NSMenuItem"* title = "Format"; ObjectId = "jQ5-Ak-Ocb"; */
"jQ5-Ak-Ocb.title" = "格式";

/* Class = "NSMenuItem"; title = "Undo"; ObjectID = "dRJ-4n-Yzg"; */
"dRJ-4n-Yzg.title" = "撤销";

/* Class = "NSMenu"; title = "Services"; ObjectID = "hz9-B4-Xy5"; */
"hz9-B4-Xy5.title" = "服务";

/* Class = "NSMenuItem"; title = "Copy background"; ObjectID = "p7U-sR-JqZ"; */
"p7U-sR-JqZ.title" = "复制背景色";

/* Class = "NSMenu"; title = "Pika"; ObjectID = "uQy-DD-JDr"; */
"uQy-DD-JDr.title" = "Pika";

/* Class = "NSMenuItem"; title = "Help"; ObjectID = "wpr-3q-Mcd"; */
"wpr-3q-Mcd.title" = "帮助";

/* Class = "NSMenuItem"; title = "Copy foreground"; ObjectID = "x3v-GG-iWU"; */
"x3v-GG-iWU.title" = "复制前景色";

/* Class = "NSMenuItem"; title = "Report feedback"; ObjectID = "hxD-2G-mEq.title"; */
"hxD-2G-mEq.title" = "报告反馈";
Binary file added Pika/Assets/zh-Hant.lproj/Localizable.strings
Binary file not shown.
Loading