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 denialOverflow
case denialInsufficiency case denialInsufficiency
case prompt case prompt
case succeeded
} }
// MARK: - IMEState types. // MARK: - IMEState types.

View File

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

View File

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