     @observeConfigs
       'cursorType': @applyCursorType
       'primaryColor': @applyPrimaryColor
-      'primaryColorAlpha': @applyPrimaryColorAlpha
+      'primaryColorAlpha': @applyPrimaryColor
       'secondaryColor': @applySecondaryColor
-      'secondaryColorAlpha': @applySecondaryColorAlpha
+      'secondaryColorAlpha': @applySecondaryColor
       'blinkInterval': @applyBlinkInterval.bind @
       'pulseDuration': @applyPulseDuration
       'cursorThickness': @applyCursorThickness

      cursorStyle.parentNode.removeChild cursorStyle
      cursorStyle = null

  applyCursorType: (cursorTypeName) ->
    cursorType = cursorTypeMap[cursorTypeName] ? cursorTypeName
    workspaceView = atom.views.getView atom.workspace
    workspaceView.className = workspaceView.className.replace /block-cursor-(?:block|bordered-box|i-beam|underline)/, ''
    workspaceView.classList.add "block-cursor-#{cursorType}"

  applyPrimaryColor: (color = @getConfig 'primaryColor') =>
    color = color.toRGBAString()
    @updateStylesheet primarySelector, 'background-color', color
    @updateStylesheet primarySelector, 'border-color', color
    if 0 is @getConfig 'blinkInterval'
      @updateStylesheet secondarySelector, 'background-color', color
      @updateStylesheet secondarySelector, 'border-color', color

  applyPrimaryColorAlpha: (alpha) =>
    primaryColor = @getConfig 'primaryColor'
    primaryColor.alpha = alpha
    @setConfig 'primaryColor', primaryColor

  applySecondaryColor: (color) =>
    if 0 is @getConfig 'blinkInterval'
      color = @getConfig 'primaryColor'
    color = color.toRGBAString()
    @updateStylesheet secondarySelector, 'background-color', color
    @updateStylesheet secondarySelector, 'border-color', color

  applySecondaryColorAlpha: (alpha) =>
    secondaryColor = @getConfig 'secondaryColor'
    secondaryColor.alpha = alpha
    @setConfig 'secondaryColor', secondaryColor

  applyBlinkInterval: do ->
    sub = null

    (interval) ->
      sub?.dispose()
      sub = atom.workspace.observeTextEditors (editor) =>
        setTimeout =>
          editorPresenter = atom.views.getView(editor).component.presenter
          editorPresenter.stopBlinkingCursors true
          if interval > 0
            @applySecondaryColor @getConfig 'secondaryColor'
            editorPresenter.cursorBlinkPeriod = interval
          else
            @applyPrimaryColor @getConfig 'primaryColor'
            editorPresenter.cursorBlinkPeriod = -1 + Math.pow 2, 31
          editorPresenter.startBlinkingCursors()
        , 0
      @subs.add sub

    sheet = @getCursorStyle().sheet
    sheet.insertRule "#{selector} { #{property}: #{value}; }", sheet.cssRules.length

module.exports = new BlockCursor()
