File indexing completed on 2024-11-24 05:01:30

0001 /*
0002     SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 function name(volume, muted, prefix) {
0008     if (!prefix) {
0009         prefix = "audio-volume";
0010     }
0011     var icon = null;
0012     var percent = volume / maxVolumeValue;
0013     if (percent <= 0.0 || muted) {
0014         icon = prefix + "-muted";
0015     } else if (percent <= 0.25) {
0016         icon = prefix + "-low";
0017     } else if (percent <= 0.75) {
0018         icon = prefix + "-medium";
0019     } else if (percent <= 1) {
0020         icon = prefix + "-high";
0021     } else if (percent <= 1.25) {
0022         icon = `${prefix}-high-warning`;
0023     } else {
0024         icon = `${prefix}-high-danger`;
0025     }
0026     return icon;
0027 }