Skip to content

Commit

Permalink
merged Swordfish90#760: Terminal frame color customization and option…
Browse files Browse the repository at this point in the history
…al glossiness
  • Loading branch information
eric2801 committed Aug 14, 2024
1 parent 8ee082f commit 9fd2e95
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
29 changes: 27 additions & 2 deletions app/qml/ApplicationSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ QtObject {
readonly property real maximumFontScaling: 2.50

readonly property real minBurnInFadeTime: 160
readonly property real maxBurnInFadeTime: 160000
readonly property real maxBurnInFadeTime: 1600

property bool isMacOS: Qt.platform.os === "osx"

Expand Down Expand Up @@ -71,6 +71,7 @@ QtObject {

property string _backgroundColor: "#000000"
property string _fontColor: "#ff8100"
property string _frameColor: "#ffffff"
property string saturatedColor: Utils.mix(Utils.strToColor("#FFFFFF"),
Utils.strToColor(_fontColor),
saturationColor * 0.5)
Expand All @@ -81,6 +82,7 @@ QtObject {
_backgroundColor),
Utils.strToColor(saturatedColor),
0.7 + (contrast * 0.3))
property color frameColor: Utils.strToColor(_frameColor)

property real staticNoise: 0.12
property real screenCurvature: 0.3
Expand All @@ -90,6 +92,7 @@ QtObject {

property real chromaColor: 0.25
property real saturationColor: 0.25
property real frameGloss: 0

property real jitter: 0.2

Expand Down Expand Up @@ -251,11 +254,13 @@ QtObject {
var settings = {
"backgroundColor": _backgroundColor,
"fontColor": _fontColor,
"frameColor": _frameColor,
"flickering": flickering,
"horizontalSync": horizontalSync,
"staticNoise": staticNoise,
"chromaColor": chromaColor,
"saturationColor": saturationColor,
"frameGloss": frameGloss,
"screenCurvature": screenCurvature,
"glowingLine": glowingLine,
"burnIn": burnIn,
Expand Down Expand Up @@ -345,6 +350,7 @@ QtObject {
_backgroundColor = settings.backgroundColor
!== undefined ? settings.backgroundColor : _backgroundColor
_fontColor = settings.fontColor !== undefined ? settings.fontColor : _fontColor
_frameColor = settings.frameColor !== undefined ? settings.frameColor : _frameColor

horizontalSync = settings.horizontalSync
!== undefined ? settings.horizontalSync : horizontalSync
Expand All @@ -353,6 +359,7 @@ QtObject {
chromaColor = settings.chromaColor !== undefined ? settings.chromaColor : chromaColor
saturationColor = settings.saturationColor
!== undefined ? settings.saturationColor : saturationColor
frameGloss = settings.frameGloss !== undefined ? settings.frameGloss : frameGloss
screenCurvature = settings.screenCurvature
!== undefined ? settings.screenCurvature : screenCurvature
glowingLine = settings.glowingLine !== undefined ? settings.glowingLine : glowingLine
Expand Down Expand Up @@ -459,6 +466,8 @@ QtObject {
"rbgShift": 0,
"saturationColor": 0.2483,
"screenCurvature": 0.3,
"frameColor": "#ffffff",
"frameGloss": 0,
"staticNoise": 0.1198,
"windowOpacity": 1,
"margin": 0.5,
Expand Down Expand Up @@ -488,6 +497,8 @@ QtObject {
"rbgShift": 0,
"saturationColor": 0.0,
"screenCurvature": 0.3,
"frameColor": "#ffffff",
"frameGloss": 0,
"staticNoise": 0.1198,
"windowOpacity": 1,
"margin": 0.5,
Expand Down Expand Up @@ -517,6 +528,8 @@ QtObject {
"rbgShift": 0,
"saturationColor": 0.5,
"screenCurvature": 0.3,
"frameColor": "#ffffff",
"frameGloss": 0,
"staticNoise": 0.15,
"windowOpacity": 1,
"margin": 0.5,
Expand Down Expand Up @@ -546,6 +559,8 @@ QtObject {
"rbgShift": 0,
"saturationColor": 0,
"screenCurvature": 0,
"frameColor": "#ffffff",
"frameGloss": 0,
"staticNoise": 0.15,
"windowOpacity": 1,
"margin": 0.5,
Expand Down Expand Up @@ -575,6 +590,8 @@ QtObject {
"rbgShift": 0,
"saturationColor": 0,
"screenCurvature": 0.5,
"frameColor": "#ffffff",
"frameGloss": 0,
"staticNoise": 0.099,
"windowOpacity": 1,
"margin": 0.5,
Expand Down Expand Up @@ -604,6 +621,8 @@ QtObject {
"rbgShift": 0.2969,
"saturationColor": 0,
"screenCurvature": 0.5,
"frameColor": "#ffffff",
"frameGloss": 0,
"staticNoise": 0.2969,
"windowOpacity": 1,
"margin": 0.5,
Expand All @@ -613,7 +632,7 @@ QtObject {
builtin: true
}
ListElement {
text: "IBM DOS"
text: "IBM Dos"
obj_string: '{
"ambientLight": 0.151,
"backgroundColor": "#000000",
Expand All @@ -633,6 +652,8 @@ QtObject {
"rbgShift": 0.3524,
"saturationColor": 0,
"screenCurvature": 0.4,
"frameColor": "#ffffff",
"frameGloss": 0,
"staticNoise": 0.0503,
"windowOpacity": 1,
"margin": 0.5,
Expand Down Expand Up @@ -662,6 +683,8 @@ QtObject {
"rbgShift": 0,
"saturationColor": 0,
"screenCurvature": 0.2,
"frameColor": "#ffffff",
"frameGloss": 0,
"staticNoise": 0,
"windowOpacity": 1,
"margin": 0.5,
Expand Down Expand Up @@ -691,6 +714,8 @@ QtObject {
"rbgShift": 0,
"saturationColor": 0.4983,
"screenCurvature": 0,
"frameColor": "#ffffff",
"frameGloss": 0,
"staticNoise": 0.0955,
"windowOpacity": 0.7,
"margin": 0.1,
Expand Down
12 changes: 12 additions & 0 deletions app/qml/SettingsTerminalTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ ColumnLayout {
value: appSettings.saturationColor
enabled: appSettings.chromaColor !== 0
}
CheckableSlider {
name: qsTr("Frame Gloss")
onNewValue: appSettings.frameGloss = newValue
value: appSettings.frameGloss
}
}
RowLayout {
Layout.fillWidth: true
Expand All @@ -166,6 +171,13 @@ ColumnLayout {
onColorSelected: appSettings._backgroundColor = color
color: appSettings._backgroundColor
}
ColorButton {
name: qsTr("Frame")
height: 50
Layout.fillWidth: true
onColorSelected: appSettings._frameColor = color
color: appSettings._frameColor
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion app/qml/ShaderTerminal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Item {

property real ambientLight: appSettings.ambientLight * 0.2

property real frameGloss: appSettings.frameGloss

property size virtualResolution
property size screenResolution

Expand All @@ -59,6 +61,7 @@ Item {
property real screenCurvature: parent.screenCurvature
property real chromaColor: parent.chromaColor
property real ambientLight: parent.ambientLight
property real frameGloss: parent.frameGloss

property real flickering: appSettings.flickering
property real horizontalSync: appSettings.horizontalSync
Expand Down Expand Up @@ -172,6 +175,7 @@ Item {
uniform highp vec4 fontColor;
uniform highp vec4 backgroundColor;
uniform lowp float shadowLength;
uniform lowp float frameGloss;
uniform highp vec2 virtualResolution;
uniform lowp float rasterizationIntensity;\n" +
Expand Down Expand Up @@ -336,7 +340,7 @@ Item {

(displayTerminalFrame ?
"vec4 frameColor = texture2D(frameSource, qt_TexCoord0);
finalColor = mix(finalColor, frameColor.rgb, frameColor.a);"
finalColor = mix(finalColor, frameColor.rgb + (finalColor*frameGloss), frameColor.a);"
: "") +

"gl_FragColor = vec4(finalColor, qt_Opacity);" +
Expand Down
4 changes: 2 additions & 2 deletions app/qml/TerminalFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import QtQuick 2.0
import "utils.js" as Utils

ShaderEffect {
property color _staticFrameColor: "#fff"
property color _frameColor: appSettings.frameColor
property color _backgroundColor: appSettings.backgroundColor
property color _fontColor: appSettings.fontColor
property color _lightColor: Utils.mix(_fontColor, _backgroundColor, 0.2)
property real _ambientLight: Utils.lint(0.2, 0.8, appSettings.ambientLight)

property color frameColor: Utils.mix(_staticFrameColor, _lightColor, _ambientLight)
property color frameColor: Utils.mix(_frameColor, _lightColor, _ambientLight)
property real screenCurvature: appSettings.screenCurvature * appSettings.screenCurvatureSize

// Coefficient of the log curve used to approximate shadowing
Expand Down

0 comments on commit 9fd2e95

Please sign in to comment.