Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #39

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Dev #39

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions QStyler/styler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from PySide6.QtCore import Qt, Signal
from PySide6.QtGui import QAction, QFontMetricsF
from PySide6.QtWidgets import (QApplication, QComboBox, QFileDialog,
QHBoxLayout, QLabel, QListWidget,
QHBoxLayout, QLabel, QLineEdit, QListWidget,
QListWidgetItem, QSlider, QTextEdit, QToolBar,
QVBoxLayout, QWidget)

Expand Down Expand Up @@ -57,6 +57,7 @@ def __init__(self, parent=None):
self.red_layout = QHBoxLayout()
self.green_layout = QHBoxLayout()
self.blue_layout = QHBoxLayout()
self.line_edit = QLineEdit()
self.red_label = QLabel("R")
self.green_label = QLabel("G")
self.blue_label = QLabel("B")
Expand All @@ -74,12 +75,14 @@ def __init__(self, parent=None):
self.blue_layout.addWidget(self.blue_label)
self.blue_layout.addWidget(self.blue_slider)
self.layout.addWidget(self.label)
self.layout.addWidget(self.line_edit)
self.layout.addLayout(self.red_layout)
self.layout.addLayout(self.green_layout)
self.layout.addLayout(self.blue_layout)
self.blue_slider.setRange(0, 255)
self.green_slider.setRange(0, 255)
self.red_slider.setRange(0, 255)
self.line_edit.setReadOnly(True)
self.blue_slider.valueChanged.connect(self.change_color)
self.red_slider.valueChanged.connect(self.change_color)
self.green_slider.valueChanged.connect(self.change_color)
Expand All @@ -98,6 +101,7 @@ def change_color(self, _):
red_value = self.red_slider.value()
color_val = [f"{i:02x}" for i in [red_value, green_value, blue_value]]
color_string = "#" + "".join(color_val)
self.line_edit.setText(color_string)
self.label.setStyleSheet(f"background-color: {color_string};")
self.colorChanged.emit(color_string)

Expand Down Expand Up @@ -495,13 +499,14 @@ def insert_color(self, color):
cursor.MoveOperation.Left, cursor.MoveMode.KeepAnchor, e - s
)
cursor.deleteChar()
self.editor.insertPlainText(color + ";")
elif result2: # pragma: nocover
s, e = second + result2.start(), pos
cursor.movePosition(
cursor.MoveOperation.Left, cursor.MoveMode.KeepAnchor, e - s
)
cursor.deleteChar()
self.editor.insertPlainText(color + ";")
self.editor.insertPlainText(color + ";")

def live_update(self):
"""Update theme in real time."""
Expand Down
733 changes: 1 addition & 732 deletions QStyler/themes/Coastal.json

Large diffs are not rendered by default.

Loading
Loading