Repo // Differentiate the colors among post-marking tooltips.

This commit is contained in:
ShikiSuen 2022-11-27 09:03:45 +08:00
parent 6ff42a8dbc
commit 383a3dd658
3 changed files with 10 additions and 2 deletions

View File

@ -120,6 +120,7 @@ public enum TooltipColorState {
case denialOverflow
case denialInsufficiency
case prompt
case succeeded
}
// MARK: - IMEState types.

View File

@ -85,6 +85,11 @@ public class TooltipUI: NSWindowController {
case .warning:
backgroundColor = NSColor.purple
textColor = NSColor.white
case .succeeded:
backgroundColor = NSColor(
red: 0.21, green: 0.15, blue: 0.02, alpha: 1.00
)
textColor = NSColor.white
case .denialOverflow:
backgroundColor = NSColor(
red: 0.13, green: 0.08, blue: 0.00, alpha: 1.00

View File

@ -141,9 +141,11 @@ extension InputHandler {
// Enter
if input.isEnter {
var tooltipMessage = "+ Successful in adding / boosting a user phrase."
var tooltipColorState: TooltipColorState = .normal
//
if input.isShiftHold, input.isCommandHold {
tooltipMessage = "- Successful in nerfing a user phrase."
tooltipColorState = .succeeded
if !state.isFilterable {
delegate.callError("2EAC1F7A")
return true
@ -159,7 +161,7 @@ extension InputHandler {
}
var newState = generateStateOfInputting()
newState.tooltip = NSLocalizedString(tooltipMessage, comment: "") + "  "
newState.data.tooltipColorState = .normal
newState.data.tooltipColorState = tooltipColorState
newState.tooltipDuration = 1.85
delegate.switchState(newState)
return true
@ -178,7 +180,7 @@ extension InputHandler {
}
var newState = generateStateOfInputting()
newState.tooltip = NSLocalizedString(tooltipMessage, comment: "") + "  "
newState.data.tooltipColorState = .normal
newState.data.tooltipColorState = .warning
newState.tooltipDuration = 1.85
delegate.switchState(newState)
return true