support dark mode on keyboard view

This commit is contained in:
Jesús A. Álvarez 2020-05-10 20:41:33 +02:00
parent 6f4cb689e4
commit a5ef2cdb68
27 changed files with 503 additions and 200 deletions

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBCapsLock~iphone@2x.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBCapsLock~iphone@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBCapsLock~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBCapsLock~ipad@2x.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBClearDown~iphone@2x.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBClearDown~iphone@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBClearDown~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBClearDown~ipad@2x.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBClearUp~iphone.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBClearUp~iphone@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBClearUp~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBClearUp~ipad@2x.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBKeyCommand@2x.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBKeyCommand@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBCommand~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBCommand@2x~ipad.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBDeleteDown~iphone@2x.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBDeleteDown~iphone@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBDeleteDown~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBDeleteDown~ipad@2x.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBDeleteUp~iphone.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBDeleteUp~iphone@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBDeleteUp~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBDeleteUp~ipad@2x.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBForwardDeleteDown~iphone@2x.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBForwardDeleteDown~iphone@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBForwardDeleteDown~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBForwardDeleteDown~ipad@2x.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBForwardDeleteUp~iphone.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBForwardDeleteUp~iphone@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBForwardDeleteUp~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBForwardDeleteUp~ipad@2x.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBHide~iphone@2x.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBHide~iphone@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBHide~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBHide~ipad@2x.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -1,103 +1,228 @@
{
"images" : [
{
"filename" : "KBKey.png",
"idiom" : "iphone",
"resizing" : {
"mode" : "9-part",
"center" : {
"mode" : "tile",
"width" : 1,
"height" : 1
},
"cap-insets" : {
"bottom" : 8,
"top" : 8,
"left" : 8,
"right" : 8,
"left" : 8
}
"top" : 8
},
"center" : {
"height" : 1,
"mode" : "tile",
"width" : 1
},
"mode" : "9-part"
},
"idiom" : "iphone",
"filename" : "KBKey.png",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "KBKey-1.png",
"idiom" : "iphone",
"resizing" : {
"mode" : "9-part",
"center" : {
"mode" : "tile",
"width" : 2,
"height" : 2
"cap-insets" : {
"bottom" : 8,
"left" : 8,
"right" : 8,
"top" : 8
},
"center" : {
"height" : 1,
"mode" : "tile",
"width" : 1
},
"mode" : "9-part"
},
"scale" : "1x"
},
{
"filename" : "KBKey@2x.png",
"idiom" : "iphone",
"resizing" : {
"cap-insets" : {
"bottom" : 16,
"top" : 16,
"left" : 16,
"right" : 16,
"left" : 16
}
"top" : 16
},
"center" : {
"height" : 2,
"mode" : "tile",
"width" : 2
},
"mode" : "9-part"
},
"idiom" : "iphone",
"filename" : "KBKey@2x.png",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "KBKey@2x-1.png",
"idiom" : "iphone",
"resizing" : {
"mode" : "9-part",
"center" : {
"mode" : "tile",
"width" : 3,
"height" : 3
"cap-insets" : {
"bottom" : 16,
"left" : 16,
"right" : 16,
"top" : 16
},
"center" : {
"height" : 2,
"mode" : "tile",
"width" : 2
},
"mode" : "9-part"
},
"scale" : "2x"
},
{
"filename" : "KBKey@3x.png",
"idiom" : "iphone",
"resizing" : {
"cap-insets" : {
"bottom" : 24,
"top" : 24,
"left" : 24,
"right" : 24,
"left" : 24
}
"top" : 24
},
"center" : {
"height" : 3,
"mode" : "tile",
"width" : 3
},
"mode" : "9-part"
},
"idiom" : "iphone",
"filename" : "KBKey@3x.png",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "KBKey@3x-2.png",
"idiom" : "iphone",
"resizing" : {
"mode" : "9-part",
"center" : {
"mode" : "tile",
"width" : 1,
"height" : 1
"cap-insets" : {
"bottom" : 24,
"left" : 24,
"right" : 24,
"top" : 24
},
"center" : {
"height" : 3,
"mode" : "tile",
"width" : 3
},
"mode" : "9-part"
},
"scale" : "3x"
},
{
"filename" : "KBKey~ipad.png",
"idiom" : "ipad",
"resizing" : {
"cap-insets" : {
"bottom" : 16,
"top" : 16,
"left" : 16,
"right" : 16,
"left" : 16
}
"top" : 16
},
"center" : {
"height" : 1,
"mode" : "tile",
"width" : 1
},
"mode" : "9-part"
},
"idiom" : "ipad",
"filename" : "KBKey~ipad.png",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "KBKey~ipad-2.png",
"idiom" : "ipad",
"resizing" : {
"mode" : "9-part",
"center" : {
"mode" : "tile",
"width" : 2,
"height" : 2
"cap-insets" : {
"bottom" : 16,
"left" : 16,
"right" : 16,
"top" : 16
},
"center" : {
"height" : 1,
"mode" : "tile",
"width" : 1
},
"mode" : "9-part"
},
"scale" : "1x"
},
{
"filename" : "KBKey@2x~ipad.png",
"idiom" : "ipad",
"resizing" : {
"cap-insets" : {
"bottom" : 32,
"top" : 32,
"left" : 32,
"right" : 32,
"left" : 32
}
"top" : 32
},
"center" : {
"height" : 2,
"mode" : "tile",
"width" : 2
},
"mode" : "9-part"
},
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "KBKey@2x~ipad-2.png",
"idiom" : "ipad",
"filename" : "KBKey@2x~ipad.png",
"resizing" : {
"cap-insets" : {
"bottom" : 32,
"left" : 32,
"right" : 32,
"top" : 32
},
"center" : {
"height" : 2,
"mode" : "tile",
"width" : 2
},
"mode" : "9-part"
},
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

View File

@ -1,103 +1,228 @@
{
"images" : [
{
"filename" : "KBKeyDark.png",
"idiom" : "iphone",
"resizing" : {
"mode" : "9-part",
"center" : {
"mode" : "tile",
"width" : 1,
"height" : 1
},
"cap-insets" : {
"bottom" : 8,
"top" : 8,
"left" : 8,
"right" : 8,
"left" : 8
}
"top" : 8
},
"center" : {
"height" : 1,
"mode" : "tile",
"width" : 1
},
"mode" : "9-part"
},
"idiom" : "iphone",
"filename" : "KBKeyDark.png",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "KBKeyDark-1.png",
"idiom" : "iphone",
"resizing" : {
"mode" : "9-part",
"center" : {
"mode" : "tile",
"width" : 2,
"height" : 2
"cap-insets" : {
"bottom" : 8,
"left" : 8,
"right" : 8,
"top" : 8
},
"center" : {
"height" : 1,
"mode" : "tile",
"width" : 1
},
"mode" : "9-part"
},
"scale" : "1x"
},
{
"filename" : "KBKeyDark@2x.png",
"idiom" : "iphone",
"resizing" : {
"cap-insets" : {
"bottom" : 16,
"top" : 16,
"left" : 16,
"right" : 16,
"left" : 16
}
"top" : 16
},
"center" : {
"height" : 2,
"mode" : "tile",
"width" : 2
},
"mode" : "9-part"
},
"idiom" : "iphone",
"filename" : "KBKeyDark@2x.png",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "KBKeyDark@2x-1.png",
"idiom" : "iphone",
"resizing" : {
"mode" : "9-part",
"center" : {
"mode" : "tile",
"width" : 3,
"height" : 3
"cap-insets" : {
"bottom" : 16,
"left" : 16,
"right" : 16,
"top" : 16
},
"center" : {
"height" : 2,
"mode" : "tile",
"width" : 2
},
"mode" : "9-part"
},
"scale" : "2x"
},
{
"filename" : "KBKeyDark@3x.png",
"idiom" : "iphone",
"resizing" : {
"cap-insets" : {
"bottom" : 24,
"top" : 24,
"left" : 24,
"right" : 24,
"left" : 24
}
"top" : 24
},
"center" : {
"height" : 3,
"mode" : "tile",
"width" : 3
},
"mode" : "9-part"
},
"idiom" : "iphone",
"filename" : "KBKeyDark@3x.png",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "KBKeyDark@3x-1.png",
"idiom" : "iphone",
"resizing" : {
"mode" : "9-part",
"center" : {
"mode" : "tile",
"width" : 1,
"height" : 1
"cap-insets" : {
"bottom" : 24,
"left" : 24,
"right" : 24,
"top" : 24
},
"center" : {
"height" : 3,
"mode" : "tile",
"width" : 3
},
"mode" : "9-part"
},
"scale" : "3x"
},
{
"filename" : "KBKeyDark~ipad.png",
"idiom" : "ipad",
"resizing" : {
"cap-insets" : {
"bottom" : 16,
"top" : 16,
"left" : 16,
"right" : 16,
"left" : 16
}
"top" : 16
},
"center" : {
"height" : 1,
"mode" : "tile",
"width" : 1
},
"mode" : "9-part"
},
"idiom" : "ipad",
"filename" : "KBKeyDark~ipad.png",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "KBKeyDark~ipad-1.png",
"idiom" : "ipad",
"resizing" : {
"mode" : "9-part",
"center" : {
"mode" : "tile",
"width" : 2,
"height" : 2
"cap-insets" : {
"bottom" : 16,
"left" : 16,
"right" : 16,
"top" : 16
},
"center" : {
"height" : 1,
"mode" : "tile",
"width" : 1
},
"mode" : "9-part"
},
"scale" : "1x"
},
{
"filename" : "KBKeyDark@2x~ipad.png",
"idiom" : "ipad",
"resizing" : {
"cap-insets" : {
"bottom" : 32,
"top" : 32,
"left" : 32,
"right" : 32,
"left" : 32
}
"top" : 32
},
"center" : {
"height" : 2,
"mode" : "tile",
"width" : 2
},
"mode" : "9-part"
},
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "KBKeyDark@2x~ipad-1.png",
"idiom" : "ipad",
"filename" : "KBKeyDark@2x~ipad.png",
"resizing" : {
"cap-insets" : {
"bottom" : 32,
"left" : 32,
"right" : 32,
"top" : 32
},
"center" : {
"height" : 2,
"mode" : "tile",
"width" : 2
},
"mode" : "9-part"
},
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBNumPad@2x.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBNumPad@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBNumPad~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBNumPad@2x~ipad.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBKeyOption@2x.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBKeyOption@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBOption~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBOption@2x~ipad.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBShiftDown~iphone@2x.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBShiftDown~iphone@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBShiftDown~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBShiftDown~ipad@2x.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -5,28 +5,31 @@
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "KBShiftUp~iphone@2x.png",
"idiom" : "iphone",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "KBShiftUp~iphone@3x.png",
"idiom" : "iphone",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "KBShiftUp~ipad.png",
"idiom" : "ipad",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "KBShiftUp~ipad@2x.png",
"idiom" : "ipad",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}

View File

@ -20,13 +20,20 @@ const NSUInteger KBKeyEventStickyKey = 1 << 24;
self.titleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
self.titleLabel.minimumScaleFactor = 0.5;
self.titleEdgeInsets = UIEdgeInsetsMake(0, 2, 0, 2);
[self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
UIColor *labelColor;
if (@available(iOS 13.0, *)) {
labelColor = [UIColor labelColor];
} else {
labelColor = [UIColor darkTextColor];
}
[self setTitleColor:labelColor forState:UIControlStateNormal];
self.tintColor = labelColor;
}
return self;
}
- (void)awakeFromNib {
[self awakeFromNib];
[super awakeFromNib];
self.dark = NO;
}

View File

@ -29,7 +29,14 @@
self = [super initWithFrame:frame];
if (self) {
safeAreaInsets = insets;
self.backgroundColor = [UIColor colorWithRed:0xEB / 255.0 green:0xF0 / 255.0 blue:0xF7 / 255.0 alpha:0.9];
if (@available(iOS 13.0, *)) {
self.backgroundColor = [UIColor clearColor];
UIVisualEffectView *backgroundView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleSystemThickMaterial]];
backgroundView.frame = self.bounds;
[self addSubview: backgroundView];
} else {
self.backgroundColor = [UIColor colorWithRed:0xEB / 255.0 green:0xF0 / 255.0 blue:0xF7 / 255.0 alpha:0.9];
}
modifiers = [NSMutableSet setWithCapacity:4];
keysDown = [NSMutableIndexSet indexSet];
}