Sha256: 5b9fd85ecc4147324fa1fb16859187ae9007f9dc4d47f3c386cea5c281b9fdc7

Contents?: true

Size: 602 Bytes

Versions: 2

Compression:

Stored size: 602 Bytes

Contents

# frozen_string_literal: true

class Scarpe
  module WebviewBorder
    def style
      styles = (super if defined?(super)) || {}
      return styles unless @border_color

      border_color = if @border_color.is_a?(Range)
        { "border-image": "linear-gradient(45deg, #{@border_color.first}, #{@border_color.last}) 1" }
      else
        { "border-color": @border_color }
      end

      styles.merge(
        "border-style": "solid",
        "border-width": "#{@options[:strokewidth] || 1}px",
        "border-radius": "#{@options[:curve] || 0}px",
      ).merge(border_color)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scarpe-0.2.1 lib/scarpe/wv/border.rb
scarpe-0.2.0 lib/scarpe/wv/border.rb