title: Swift - Visionkit How to edit the color of the buttons "Keep Scan" and "Retake"
body: <p>I have a problem.
  I've implemented the visionkit framework in order to detect a text when the camera is used.
  The problem is that the colors of the buttons: &quot;Keep Scan&quot; and &quot;Retake&quot; are blue. I want them in black color. How can I fix this problem? I paste my code.
  Thank you in advance!</p>
  <pre><code>import UIKit
  import Vision
  import VisionKit
  
  class ScanText: UIViewController, VNDocumentCameraViewControllerDelegate {
      
      @IBOutlet weak var imageView: UIImageView!
      @IBOutlet weak var TextScan: UITextView!
      @IBOutlet weak var buttonStartShape: UIButton!
      @IBOutlet weak var infoScattaUnaFoto: UILabel!
      @IBOutlet weak var copyButtonShape: UIButton!
      
      var textRecognitionRequest = VNRecognizeTextRequest(completionHandler: nil)
      private let textRecognitionWorkQueue = DispatchQueue(label: &quot;MyVisionScannerQueue&quot;, qos: .userInitiated, attributes: [], autoreleaseFrequency: .workItem)
      
      var classView = ViewController()
      var arrayText = String()
      
      override func viewDidLoad() {
          super.viewDidLoad()
          imageView.layer.cornerRadius = 15
          imageView.clipsToBounds = true
          
          TextScan.layer.cornerRadius = 15
          TextScan.clipsToBounds = true
          
          copyButtonShape.layer.cornerRadius = 25
          copyButtonShape.clipsToBounds = true
          
          buttonStartShape.layer.cornerRadius = 25
          buttonStartShape.clipsToBounds = true
          
          TextScan.isEditable = true
          setupVision()
          
          
          
      }
      
      @IBAction func TakePicture(_ sender: Any) {
          let scannerViewController = VNDocumentCameraViewController()
          scannerViewController.delegate = self
          present(scannerViewController, animated: true)
          
      }
      
      
      private func setupVision() {
        
          textRecognitionRequest = VNRecognizeTextRequest { (request, error) in
              guard let observations = request.results as? [VNRecognizedTextObservation] else { return }
              
              var detectedText = &quot;&quot;
              for observation in observations {
                  guard let topCandidate = observation.topCandidates(2).first else { return }
                  print(&quot;text \(topCandidate.string) has confidence \(topCandidate.confidence)&quot;)
                  
                  
                  detectedText += topCandidate.string
                  detectedText += &quot;\n&quot;
                  
                  
              }
              
              DispatchQueue.main.async {
                  self.TextScan.isHidden = false
                   self.infoScattaUnaFoto.isHidden = true
                  self.copyButtonShape.isHidden = false
                  self.buttonStartShape.setTitle(&quot;Ripeti&quot;, for: .normal)
                  self.TextScan.text += detectedText
                  self.TextScan.flashScrollIndicators()
                  
              }
          }
          
          textRecognitionRequest.recognitionLevel = .accurate
      }
      private func processImage(_ image: UIImage) {
          imageView.image = image
          recognizeTextInImage(image)
      }
      
      private func recognizeTextInImage(_ image: UIImage) {
          guard let cgImage = image.cgImage else { return }
          
          TextScan.text = &quot;&quot;
          textRecognitionWorkQueue.async {
              let requestHandler = VNImageRequestHandler(cgImage: cgImage, options: [:])
              do {
                  try requestHandler.perform([self.textRecognitionRequest])
              } catch {
                  print(error)
              }
          }
      }
      func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFinishWith scan: VNDocumentCameraScan) {
          /* guard scan.pageCount &gt;= 1 else {
           controller.dismiss(animated: true)
           return
           }*/
          for i in 0 ..&lt; scan.pageCount {
              let img = scan.imageOfPage(at: i)
              processImage(img)
              
          }
          
          let originalImage = scan.imageOfPage(at: 0)
          print(originalImage)
          //let newImage = compressedImage(originalImage)
          controller.dismiss(animated: true)
          
          
      }
      
      func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFailWithError error: Error) {
          print(error)
          controller.dismiss(animated: true)
      }
      
      func documentCameraViewControllerDidCancel(_ controller: VNDocumentCameraViewController) {
          controller.dismiss(animated: true)
      }
      
      func compressedImage(_ originalImage: UIImage) -&gt; UIImage {
          guard let imageData = originalImage.jpegData(compressionQuality: 1),
              let reloadedImage = UIImage(data: imageData) else {
                  return originalImage
          }
          return reloadedImage
      }
      //MARK: By tapping on this button, I pass all the data.
      
      @IBAction func CopyText(_ sender: Any) {
          let vc = (storyboard?.instantiateViewController(identifier: &quot;SpeakDetail&quot;) as? ViewController)!
          
          vc.textscannerized = TextScan.text
          
          self.navigationController?.pushViewController(vc, animated: true)
          
      }
      
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/OMcHI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OMcHI.jpg" alt="This is the image" /></a></p>