diff --git a/app/ApplicationSettings.qml b/app/ApplicationSettings.qml index 3ad1712..242f681 100644 --- a/app/ApplicationSettings.qml +++ b/app/ApplicationSettings.qml @@ -59,8 +59,9 @@ Item{ property string _background_color: "#000000" property string _font_color: "#ff8100" - property color font_color: mix(strToColor(_font_color), strToColor(_background_color), 0.7 + (contrast * 0.3)) - property color background_color: mix(strToColor(_background_color), strToColor(_font_color), 0.7 + (contrast * 0.3)) + property string saturated_color: mix(strToColor("#FFFFFF"), strToColor(_font_color), saturation_color * 0.5) + property color font_color: mix(strToColor(saturated_color), strToColor(_background_color), 0.7 + (contrast * 0.3)) + property color background_color: mix(strToColor(_background_color), strToColor(saturated_color), 0.7 + (contrast * 0.3)) property real noise_strength: 0.1 property real screen_distortion: 0.1 @@ -68,6 +69,9 @@ Item{ property real motion_blur: 0.40 property real bloom_strength: 0.65 + property real chroma_color: 0.0 + property real saturation_color: 0.0 + property real jitter: 0.18 property real horizontal_sincronization: 0.08 @@ -173,6 +177,8 @@ Item{ brightness_flickering: brightness_flickering, horizontal_sincronization: horizontal_sincronization, noise_strength: noise_strength, + chroma_color: chroma_color, + saturation_color: saturation_color, screen_distortion: screen_distortion, glowing_line_strength: glowing_line_strength, frames_index: frames_index, @@ -238,6 +244,8 @@ Item{ horizontal_sincronization = settings.horizontal_sincronization !== undefined ? settings.horizontal_sincronization : horizontal_sincronization brightness_flickering = settings.brightness_flickering !== undefined ? settings.brightness_flickering : brightness_flickering; noise_strength = settings.noise_strength !== undefined ? settings.noise_strength : noise_strength; + chroma_color = settings.chroma_color !== undefined ? settings.chroma_color : chroma_color; + saturation_color = settings.saturation_color !== undefined ? settings.saturation_color : saturation_color; screen_distortion = settings.screen_distortion !== undefined ? settings.screen_distortion : screen_distortion; glowing_line_strength = settings.glowing_line_strength !== undefined ? settings.glowing_line_strength : glowing_line_strength; @@ -307,42 +315,42 @@ Item{ id: profileslist ListElement{ text: "Default Amber" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.4,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.4,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "Default Green" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "Default Scanlines" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "Default Pixelated" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "Apple ][" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "Vintage" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontIndex":0,"font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontIndex":0,"font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "IBM Dos" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":1,"saturation_color":0}' builtin: true } ListElement{ text: "Transparent Green" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4549689440993788,"brightness":0.5,"brightness_flickering":0.20341614906832298,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.15993788819875776,"horizontal_sincronization":0.05045871559633028,"jitter":0.20341614906832298,"motion_blur":0.24999999999999997,"noise_strength":0.20031055900621117,"rasterization":0,"screen_distortion":0.05045871559633028,"windowOpacity":0.5956221198156681}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4549689440993788,"brightness":0.5,"brightness_flickering":0.20341614906832298,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.15993788819875776,"horizontal_sincronization":0.05045871559633028,"jitter":0.20341614906832298,"motion_blur":0.24999999999999997,"noise_strength":0.20031055900621117,"rasterization":0,"screen_distortion":0.05045871559633028,"windowOpacity":0.5956221198156681,"chroma_color":0,"saturation_color":0}' builtin: true } } diff --git a/app/PreprocessedTerminal.qml b/app/PreprocessedTerminal.qml index 39a07cf..7720f49 100644 --- a/app/PreprocessedTerminal.qml +++ b/app/PreprocessedTerminal.qml @@ -220,7 +220,6 @@ Item{ id: finalSource sourceItem: blurredterminal sourceRect: frame.sourceRect - //format: ShaderEffectSource.Alpha hideSource: true } ShaderEffect { @@ -246,6 +245,10 @@ Item{ "uniform lowp sampler2D blurredSource;" : "") + + "float rgb2grey(vec3 v){ + return dot(v, vec3(0.21, 0.72, 0.04)); + }" + + "void main() {" + "vec2 coords = qt_TexCoord0;" + (mScanlines != shadersettings.no_rasterization ? " @@ -254,16 +257,18 @@ Item{ coords.x = floor(virtual_resolution.x * coords.x) / virtual_resolution.x;" : "") : "") + "coords = coords + delta;" + - "vec4 vcolor = texture2D(source, coords) * 256.0; - float color = vcolor.r * 0.21 + vcolor.g * 0.72 + vcolor.b + 0.04;" + + + "vec4 color = texture2D(source, coords) * 256.0; + color.a = rgb2grey(color.rgb);" + + (mBlur !== 0 ? - "float blurredSourceColor = texture2D(blurredSource, coords).a * 256.0;" + - "blurredSourceColor = blurredSourceColor - blurredSourceColor * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" + - "color = step(1.0, color) * color + step(color, 1.0) * blurredSourceColor;" + "vec4 blur_color = texture2D(blurredSource, coords) * 256.0;" + + "blur_color.a = blur_color.a - blur_color.a * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" + + "color = step(1.0, color.a) * color + step(color.a, 1.0) * blur_color;" : "") + - "gl_FragColor.a = floor(color) / 256.0;" + + "gl_FragColor = floor(color) / 256.0;" + "}" onStatusChanged: if (log) console.log(log) //Print warning messages diff --git a/app/SettingsTerminalTab.qml b/app/SettingsTerminalTab.qml index 04e473f..f8116c8 100644 --- a/app/SettingsTerminalTab.qml +++ b/app/SettingsTerminalTab.qml @@ -92,21 +92,37 @@ Tab{ GroupBox{ title: qsTr("Colors") Layout.fillWidth: true - RowLayout{ + ColumnLayout{ anchors.fill: parent - ColorButton{ - name: qsTr("Font") - height: 50 + RowLayout{ Layout.fillWidth: true - onColorSelected: shadersettings._font_color = color; - button_color: shadersettings._font_color + ColorButton{ + name: qsTr("Font") + height: 50 + Layout.fillWidth: true + onColorSelected: shadersettings._font_color = color; + button_color: shadersettings._font_color + } + ColorButton{ + name: qsTr("Background") + height: 50 + Layout.fillWidth: true + onColorSelected: shadersettings._background_color = color; + button_color: shadersettings._background_color + } } - ColorButton{ - name: qsTr("Background") - height: 50 + ColumnLayout{ Layout.fillWidth: true - onColorSelected: shadersettings._background_color = color; - button_color: shadersettings._background_color + CheckableSlider{ + name: qsTr("Chroma Color") + onValueChanged: shadersettings.chroma_color = value + _value: shadersettings.chroma_color + } + CheckableSlider{ + name: qsTr("Saturation Color") + onValueChanged: shadersettings.saturation_color = value + _value: shadersettings.saturation_color + } } } } diff --git a/app/ShaderTerminal.qml b/app/ShaderTerminal.qml index ad3b1d7..b4b12e1 100644 --- a/app/ShaderTerminal.qml +++ b/app/ShaderTerminal.qml @@ -39,6 +39,9 @@ ShaderEffect { property real screen_distorsion: shadersettings.screen_distortion property real glowing_line_strength: shadersettings.glowing_line_strength + property real chroma_color: shadersettings.chroma_color; + property real saturation_color: shadersettings.saturation_color; + property real brightness_flickering: shadersettings.brightness_flickering property real horizontal_sincronization: shadersettings.horizontal_sincronization @@ -143,6 +146,9 @@ ShaderEffect { return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0001))) * glowing_line_strength; }" : "") + + "float rgb2grey(vec3 v){ + return dot(v, vec3(0.21, 0.72, 0.04)); + }" + "void main() {" + "vec2 cc = vec2(0.5) - qt_TexCoord0;" + @@ -175,7 +181,7 @@ ShaderEffect { vec2 txt_coords = coords + offset * "+str(jitter)+";" : "vec2 txt_coords = coords;") + - "float color = texture2D(source, txt_coords).a;" + + "float color = 0.0;" + (noise_strength !== 0 ? " float noiseVal = texture2D(noiseSource, qt_TexCoord0 + vec2(fract(time / 51.0), fract(time / 237.0))).a; @@ -184,17 +190,33 @@ ShaderEffect { (glowing_line_strength !== 0 ? " color += randomPass(coords) * glowing_line_strength;" : "") + - "vec3 finalColor = mix(background_color, font_color, color).rgb;" + + (chroma_color !== 0 ? + "vec4 realBackColor = texture2D(source, txt_coords);" + + "vec4 mixedColor = mix(font_color, realBackColor * font_color, "+ str(chroma_color) +");" + + + "vec4 finalBackColor = mix(background_color, mixedColor, realBackColor.a);" + + "vec3 finalColor = mix(finalBackColor, font_color, color).rgb;" + : + "color += texture2D(source, txt_coords).a;" + + "vec3 finalColor = mix(background_color, font_color, color).rgb;" + ) + + "finalColor *= texture2D(rasterizationSource, coords).a;" + - (bloom !== 0 ? " - finalColor += font_color.rgb * texture2D(bloomSource, coords).r *" + str(bloom) + ";" : "") + + (bloom !== 0 ? + "vec3 bloomColor = texture2D(bloomSource, coords).rgb;" + + (chroma_color !== 0 ? + "bloomColor = font_color.rgb * mix(vec3(rgb2grey(bloomColor)), bloomColor, "+str(chroma_color)+");" + : + "bloomColor = font_color.rgb * rgb2grey(bloomColor);") + + "finalColor += bloomColor * "+str(bloom)+";" + : "") + (brightness_flickering !== 0 ? " finalColor *= brightness;" : "") + - "gl_FragColor = vec4(finalColor *"+str(brightness)+", qt_Opacity); - }" + "gl_FragColor = vec4(finalColor *"+str(brightness)+", qt_Opacity);" + + "}" onStatusChanged: if (log) console.log(log) //Print warning messages } diff --git a/app/frames/utils/FrameShader.qml b/app/frames/utils/FrameShader.qml index fee9045..78a1142 100644 --- a/app/frames/utils/FrameShader.qml +++ b/app/frames/utils/FrameShader.qml @@ -13,6 +13,8 @@ ShaderEffect{ property bool frameReflections: shadersettings.frameReflections property variant lightSource: reflectionEffectSourceLoader.item + property real chroma_color: shadersettings.chroma_color + Loader{ id: reflectionEffectLoader width: parent.width * 0.33 @@ -62,6 +64,10 @@ ShaderEffect{ return (coords + cc * (1.0 + dist) * dist); } + float rgb2grey(vec3 v){ + return dot(v, vec3(0.21, 0.72, 0.04)); + } + void main(){ vec2 coords = distortCoordinates(qt_TexCoord0); vec4 txt_color = texture2D(source, coords); @@ -72,16 +78,20 @@ ShaderEffect{ float dotProd = dot(normal, light_direction);" + (frameReflections ? " - float screenLight = texture2D(lightSource, coords).r; + vec3 realLightColor = texture2D(lightSource, coords).rgb; + float screenLight = rgb2grey(realLightColor); float clampedDotProd = clamp(dotProd, 0.05, 1.0); float diffuseReflection = clamp(screenLight * 1.5 * clampedDotProd, 0.0, 0.35); - float reflectionAlpha = mix(1.0, 0.90, dotProd);" + float reflectionAlpha = mix(1.0, 0.90, dotProd); + vec3 lightColor = mix(font_color.rgb * screenLight, font_color.rgb * realLightColor, "+chroma_color.toFixed(2)+");" : " float diffuseReflection = 0.0; - float reflectionAlpha = 1.0;") + " + float reflectionAlpha = 1.0; + vec3 lightColor = font_color.rgb;") + " + vec3 back_color = background_color.rgb * (0.2 + 0.5 * dotProd); - vec3 front_color = font_color.rgb * (0.05 + diffuseReflection); + vec3 front_color = lightColor * (0.05 + diffuseReflection); vec4 dark_color = vec4((back_color + front_color) * txt_normal.a, txt_normal.a * reflectionAlpha); gl_FragColor = mix(dark_color, txt_color, ambient_light); diff --git a/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema b/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema index 4df8184..b9340a7 100644 --- a/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema +++ b/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema @@ -36,22 +36,23 @@ color 1 0 0 0 1 0 # regular background color (Black) color 2 0 0 0 0 0 # regular color 0 Black -color 3 59 59 59 0 0 # regular color 1 Red +color 3 255 43 43 0 0 # regular color 1 Red -color 4 137 137 137 0 0 # regular color 2 Green +color 4 28 172 120 0 0 # regular color 2 Green -color 5 116 116 116 0 0 # regular color 3 Yellow +color 5 248 213 104 0 0 # regular color 3 Yellow -color 6 39 39 39 0 0 # regular color 4 Blue +color 6 43 108 196 0 0 # regular color 4 Blue -color 7 70 70 70 0 0 # regular color 5 Magenta +color 7 255 29 206 0 0 # regular color 5 Magenta -color 8 148 148 148 0 0 # regular color 6 Cyan +color 8 24 167 181 0 0 # regular color 6 Cyan color 9 179 179 179 0 0 # regular color 7 White + # intensive colors @@ -68,17 +69,17 @@ color 11 0 0 0 1 0 # intensive background color color 12 106 106 106 0 0 # intensive color 0 -color 13 122 122 122 0 0 # intensive color 1 +color 13 253 94 83 0 0 # intensive color 1 -color 14 207 207 207 0 0 # intensive color 2 +color 14 168 228 160 0 0 # intensive color 2 -color 15 243 243 243 0 0 # intensive color 3 +color 15 254 254 34 0 0 # intensive color 3 -color 16 99 99 99 0 0 # intensive color 4 +color 16 154 206 235 0 0 # intensive color 4 -color 17 134 134 134 0 0 # intensive color 5 +color 17 252 116 253 0 0 # intensive color 5 -color 18 219 219 219 0 0 # intensive color 6 +color 18 236 234 190 0 0 # intensive color 6 color 19 255 255 255 0 0 # intensive color 7